Hi Brian,
I'll respond based on Sanitago's assessment. (He's having trouble
getting mail on the xalan-dev alias).
#1 This seems like a reasonable enhancement. Would you file an
enhancement request in Bugzilla.
#2 This is not really doable giving the compile/runtime architecture
of XSLTC.
#3 This is already supported for nonstatic external Java functions.
There a few ways to call such a function. For example:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan-java="http://xml.apache.org/xslt/java"
xmlns:java="http://xml.apache.org/xslt/java"
xmlns:xsltc-java="http://xml.apache.org/xalan/xsltc/java"
xmlns:xalan-java-math="http://xml.apache.org/xslt/java/java.lang.Math"
xmlns:xsltc-java-math="http://xml.apache.org/xalan/xsltc/java/java.lang.Math">
<xsl:template match="/">
<xsl:value-of select="xalan-java:java.lang.Math.sin(1.2)"/>
<xsl:value-of select="java:java.lang.Math.sin(1.2)"/>
<xsl:value-of select="xsltc-java:java.lang.Math.sin(1.2)"/>
<xsl:value-of select="xalan-java-math:sin(1.2)"/>
<xsl:value-of select="xsltc-java-math:sin(1.2)"/>
<!-- This instruction reports a warning at compile time
<xsl:value-of select="xalan-java:nodeset()"/>
-->
</xsl:template>
</xsl:stylesheet>
Brian Hilst wrote:
>
> I am attempting to convert some Xalan extension functions to work with
> XSLTC. I need the following functionality and wonder if someone can tell me
> if it is possible.
>
> 1. Pass an org.w3c.dom.NodeList param to an extension functions
> 2. Conduct XPath queries within the extension function and return a
> NodeList
> 3. Call a non-static method on an object passed into the transformation as
> a parameter
>
> I tested NodeList params (#1 above), but get errors from the XSLTC compiler:
>
> Unable to resolve call to function 'http://xml.apache.org/xslt/java:eval'
>
> The function is declared as follows:
>
> public static String eval(org.w3c.dom.NodeList nodeList, String pattern)
>
> It works with methods that don't have NodeList params, so I know I've got
> everything declared correctly.
>
> I noticed in FunctionCall.java, there are mappings declared from internal to
> org.w3c.dom.NodeList. However, when it is trying to resolve the function
> mapping the internal param is of ReferenceType and this doesn't map to
> anything.
>
> ...Brian
--
Tom Amiro -- SQA Engineer
Sun XML Technology Development
voice: 781-442-0589 Fax: 781-442-1437
eMail: [email protected]