DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10837>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10837

xsltc does not convert NodeList to internal node-set type

           Summary: xsltc does not convert NodeList to internal node-set
                    type
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


This problem was reported by Ferdinand O Shahagun ([EMAIL PROTECTED]).

With the xsl and Java extension function shown below, xsltc is giving 

       Unable to resolve call to function
'http://xml.apache.org/xslt/java:tapIt'.

According to Santiago Pericas, the problem here is that xsltc does not support 
conversions from NodeList to our internal node-set type. This should be added 
as an enhancement: the way to implement this is to create a DOM from the 
NodeList and then to get a ChildIterator from the DOM using the root node as 
the context node. 

In the meantime, Santiago has added a more informative error message 
to spell out the problem with type conversion.

XSL
---
<xsl:stylesheet version="1.0" xmlns:xsl
="http://www.w3.org/1999/XSL/Transform";
                        xmlns:java
="com.systemaccess.ci.contentTransformer.XSLTExtension"
                  xmlns:myown-xsltc="http://xml.apache.org/xslt/java";
                  xmlns:xsltc-extension="http://xml.apache.org/xalan/xsltc";
                        exclude-result-prefixes="xalan">

    <xsl:template match="/">
         <xsl:call-template name="processXSL">
                <xsl:with-param name="nodeToUse" select="/" />
           </xsl:call-template>
    </xsl:template>

    <xsl:template name="processXSL">
     <xsl:param name="nodeToUse" />
        <xsl:variable name="printIt" select
="myown-xsltc:XSLTExtension.tapIt(xsltc-extension:nodeset
($nodeToUse),'test')"/>
        <xsl:copy-of select="$printIt"/>
    </xsl:template>
</xsl:stylesheet>


Java code
---------
/*************

*************/
...
public  class XSLTExtension{
    public static org.w3c.dom.NodeList tapIt(org.w3c.dom.NodeList node,
String temp){
        DOMResult  dom = new DOMResult();
      ... do some more transformation...
        System.out.println("SUCCCESSFUL CALL");
        return (dom.getNode()).getChildNodes();
    }
}

Reply via email to