xsl-list
[Top] [All Lists]

RE: Calling a java function and returning a NodeList

2002-09-21 04:20:11
Can i return a Nodelist or a Node from a Java function to a 
XSL. I want to return the Node or Nodelist using JAXP and not 
go with any 
specific XML Parser. I learnt that saxon needs NodeList built 
using its own 
parser. Is there any way around?. I want my java code and xsl 
fully compiant 
with JAXP and Trax API.

The most portable way of doing this is to use the document() function
with a URI of your own invention, along with a URIResolver that returns
the result in the form of a DOMSource, SAXSource, or StreamSource
object.

This is a bit tricky, though, if your function has complex parameters.
In this case you are stuck with using extension functions, and each XSLT
processor has its own rules for what arguments and return values it
accepts. Many XSLT processors will only accept DOM nodes that were
created by the same product, e.g. if you use the Oracle XSLT processor
you have to use the Oracle DOM implementation. Recent release of Saxon
allow an extension function to return a DOMSource, which can wrap any
DOM - but it's expensive.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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