custom function resolver in xslt transformation (called from Java)?
Posted on 2008-11-09
I am trying to make a custom function resolver available to my xslt transformations.
Specificlly, the following should work:
<xsl:variable select="myNS:myFunction($arg1)" />
where my function returns a node or node set.
I pretty much have everything I need for executing single XPaths:
XPath xpath = XPathFactory.newInstance().newXPath();
Well, this works.
However, when I do an xslt transformation like this:
Transformer transformer = factory.newTransformer(source);
final Result result = new javax.xml.transform.stream.StreamResult(System.out);
I don't see any place where I can pass a custom function resolver :-(
I need my functions to be available in a complex stylesheet, not just in a "simple xpath".
(how) Can this be done?
Thanks in advance for any help!
P.S.: This should work "out of the box" in Java 5 and higher. It should not require additional libraries and should not be specific to Xalan or Saxon it at all possible...