It this more appropriate for the dev list?

-----Original Message-----
From:   Derek Lewis
Sent:   Wed 2/4/2004 3:41 PM
To:     [EMAIL PROTECTED]
Cc:     
Subject:        XSLTC extension function returning NodeList?
I understand from the documentation that org.w3c.dom.NodeList is a valid return-type 
for an extension function, that should be converted approptiately.
I'm having problems, however, whenever I try to output the NodeList using xsl:copy-of. 
 I can call count($list) or count($list/*), or I can even do a xsl:value-of on $list 
or $list/*, and they all behave as I would expect.
However, when I try to do xsl:copy-of on $list or $list/*, I get an 
ArrayIndexOutOfBoundsException.
The NodeList I return has one element (in this case), and that element has around 70 
child elements, and a few attributes.

The exception I see when I do <xsl:copy-of select="$list/*" /> is:
org.apache.xalan.xsltc.TransletException: java.lang.ArrayIndexOutOfBoundsException: -7 
< 0
        at org.apache.xalan.xsltc.dom.SAXImpl.copy(SAXImpl.java:1392)
        at org.apache.xalan.xsltc.dom.DOMAdapter.copy(DOMAdapter.java:309)
        at org.apache.xalan.xsltc.dom.MultiDOM.copy(MultiDOM.java:540)
        at components1.template$dot$4()
        at components1.applyTemplates2()
        at components1.template$dot$1()
        at components1.applyTemplates2()
        at components1.applyTemplates()
        at components1.transform()

(components1 is the name of my xslt file)

I added a e.printStackTrace to the dom.SAXImpl class so I could see what the real 
exception is and got a few extra lines:
java.lang.ArrayIndexOutOfBoundsException: -7 < 0
        at java.util.Vector.elementAt(Vector.java:427)
        at org.apache.xml.dtm.ref.sax2dtm.SAX2DTM2.copyAttribute(SAX2DTM2.java:3347)
        at org.apache.xalan.xsltc.dom.SAXImpl.copy(SAXImpl.java:1361)
        at org.apache.xalan.xsltc.dom.DOMAdapter.copy(DOMAdapter.java:309)
        at org.apache.xalan.xsltc.dom.MultiDOM.copy(MultiDOM.java:540)

I've tried this with my own implementation of NodeList, and with 
org.apache.xpath.NodeSet, and I get the exact same stack trace regardless of which I 
use.

Any suggestions?



Reply via email to