Title: xpath use in extension

Hi,

I am trying to do the following, i define a variable in my xsl file as the following:

<xsl:variable name="var1>
        <info1 value="test" />
        <info2 value="test" />

</xsl:variable>

and I pass thi vaiable to an extension function :

<xsl:copy-of select="myext:getdata2($var1)" />

I defined my function as follows:

public Document getdata2(Object input){
                DTMNodeIterator it = (DTMNodeIterator) input;
               Document inputDoc = (Document) it.getRoot();   

        ....
}

When I dump the inputdoc to file, it contains the data from var1 as I expect.

Now I try to get specific data from the input doc with the XPathAPI object, e..g.

        XPathAPI.selectNodeList(inputDoc,"/")

but this gives met the following error
java.lang.ArrayIndexOutOfBoundsException: -1
        at org.apache.xml.utils.SuballocatedIntVector.elementAt(SuballocatedIntV
ector.java:454)
        at org.apache.xml.dtm.ref.DTMDefaultBase._firstch(DTMDefaultBase.java:52
0)
        at org.apache.xml.dtm.ref.DTMDefaultBase.getFirstChild(DTMDefaultBase.ja
va:965)
        at org.apache.xml.dtm.ref.DTMNodeProxy.getDocumentElement(DTMNodeProxy.j
ava:605)
        at org.apache.xpath.XPathAPI.eval(XPathAPI.java:274)
        at org.apache.xpath.XPathAPI.selectNodeList(XPathAPI.java:211)
        at org.apache.xpath.XPathAPI.selectNodeList(XPathAPI.java:191)
        at interchain.ext.XmlProvider.getdata2(XmlProvider.java:203)      


Can anyone explain to me what I am doing wrong here ? Any alternatives ?

Kind regards,
Marco Laponder

mlr AT interchain DOT nl

Reply via email to