xsl-list
[Top] [All Lists]

RE: Custom function and Saxon

2004-05-05 11:26:41

Hi Mickael,

First of all, i verified my code and put the system-property function in my
xsl file. Here is the result:
  <?xml version="1.0" encoding="UTF-8" ?>
    - <root xmlns:pfx2="java:Custom">
        <Vendor>SAXON 7.9.1 from Saxonica</Vendor>
        <IdFamily>1</IdFamily>
        <FirstName>Adelaide</FirstName>
    </root>

  It seems that this implementation of my code is working well. Moreover, i
  only have the saxon7.jar file in my classpath and I don't think there is
  any other way i could use Xalan Processor.

  For my first request, (using a jar file without naming all the classes),
  i'll find another way to do it.. Thank you very much

  Adrien Dauchez



|---------+---------------------------->
|         |           "Michael Kay"    |
|         |           <mhk(_at_)mhk(_dot_)me(_dot_)uk>  |
|         |                            |
|         |           05/05/04 01:47 PM|
|         |           Please respond to|
|         |           xsl-list         |
|         |                            |
|---------+---------------------------->
  
------------------------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                                 |
  |       To:       <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>          
                                                                  |
  |       cc:                                                                   
                                                 |
  |       Subject:  RE: [xsl] Custom function and Saxon                         
                                                 |
  
------------------------------------------------------------------------------------------------------------------------------|




I'm trying to use several java custom functions i wrote.
First, I've put the java class in a jar file (function.jar)
and include the
following code in my xsl file :

<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="
1.0"
  xmlns:java="http://xml.apache.org/xslt/java";
  xmlns:pfx="java:Custom">

Here is the code i use in order to print a trimmed data :

      <IdFamily><xsl:value-of select="pfx:trim('    Test     ')"/></
IdFamily>

 When i execute the Saxon processor,  it works well !

I don't think this will work in Saxon. You are using the Xalan way of
calling Java extension functions, and this will only work in Xalan. I
suspect you are using Xalan and not Saxon. Check the value ofThans
system-property('xsl:vendor').

Now, i want to include all the classes contained in the same jar file.
Let's say i have twos classes names example1.class and
example2.class in my
jar file. How can i use all the functions specified in the
two class files
without naming all this classes ?

Saxon's binding of Java extension functions does not allow you to call a
Java method without explicitly naming the class that it belongs to as part
of the URI used in the function name.

Michael Kay


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--








*************************************************************************
This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates 
shall be liable for the message if altered, changed or falsified. 

*************************************************************************



<Prev in Thread] Current Thread [Next in Thread>