Please see the note in the documentation at
http://xml.apache.org/xalan-j/extensions.html#ext-functions in the
section entitled "Return Values".

It states:
"The return value conversion can sometimes cause confusion. For example,
if your extension function returns an object that is a subclass of
NodeIterator, that object will be converted by Xalan-Java to an XSLT
Node-Set. If you later attempt to treat that object as a non-XSLT object
of your original class and try to invoke a method on that object, your
method invocation will fail."

Gary

> -----Original Message-----
> From: Phillip Lord [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, October 31, 2001 4:41 AM
> To: [EMAIL PROTECTED]
> Subject: Extension functions
> 
> 
> 
> 
> 
> 
>         I'm a little confused about the return conversion of 
> values from a Xalan extension function. 
> 
>         Ideally I would like to return something like an 
> iterator and then operate over that object within XSL. 
> 
> 
>         So for instance.....
> 
> 
>         
>     <xsl:variable name="iterator"
>       select="java:getIterator( $java_object )"/>
> 
> 
>        where $java_object is some appropriate object that I have 
> previously created. 
> 
>         Now this all works fine, but I was sort of assuming that 
> I could then operate on this object which appears not to be 
> the case. For instance if I try
> 
>     <xsl:message>
>       Iterator
>       <xsl:value-of select="java:toString( $iterator )"/>
>     </xsl:message>
> 
>        then I get a crash. 
> 
>         Which is a little annoying.
> 
>         Now of course there are a couple of alternatives here. 
> I could for instance write a wrapper Object which takes objects of 
> type $java_object in the constructor. That way I could create 
> an object with Xalan that I should have access to. But it's 
> really messy. 
> 
>        I was under the impression that if the return type of 
> a function where not of a set of specific XSLT types, then it 
> would be left as a non XSLT object, and I should be able to 
> operate on it as a Java object. 
> 
>         But I can't.
> 
>         Any ideas about how I can get this to work. Alternatively 
> is there another way that I can manipulate Java objects with Xalan.
> 
>         Thanks
> 
>         Phil
> 
> 
>         
>         
> 

Reply via email to