Being new to Saxon / XSLT processing, I might ask something too obvious for someone more experienced. Please excuse my innocence =)
I'm trying to write an XSLT "integrated extension function" with Saxon 9.2, using javax.xml.transform.
I have looked at one of the existing implementations (net.sf.saxon.functions.ItemAt.java, for example), as was suggested in the documentation. Now I need to register this extension function somehow. In the docs, it is mentioned that:
"Having written an integrated extension function, it must be registered with Saxon so that calls on the function are recognized by the parser. This is done using the registerExtensionFunction method available on the Configuration class, and also on the s9api Processor class. It can also be registered via an entry in the configuration file. The function can be given any name, although names in the fn:, xs:, and saxon: namespaces are strongly discouraged and may not work.
It is also possible to register integrated extension functions under XQJ, using the SaxonXQStaticContext class which implements the XQStaticContext interface."
Because I intend to use standard XML APIs for this implementation, I have a few questions:
- using the first method ( i.e. Configuration.registerExtensionFunction() ), in the Configuration javadoc, it says:
"This class holds details of user-selected configuration options for a set of transformations and/or queries. When running XSLT, the preferred way of setting configuration options is via the JAXP TransformerFactory interface, but the Configuration object provides a finer level of control. As yet there is no standard API for XQuery, so the only way of setting Configuration information is to use the methods on this class directly."
-- Does this mean that I can register an XSLT integrated extension function through one of the TransformerFactory methods? If yes, can you please specify the call with some sample arguments?
-- Is there another way of calling Configuration.registerExtensionFunction() when using the javax.xml.transform?
- using the last methos ( i.e. XQStaticContext interface ), how should such a registration be accomplished?
Thank you in advance for your help,