[ http://issues.apache.org/jira/browse/XALANJ-2039?page=all ]

Marco Laponder updated XALANJ-2039:
-----------------------------------

    Attachment: XPathExtension.java
                xp.xsl

The XPathExtension.java contains the extension which try to xpath on the input 
variable. The xp.xsl contains an examples call of this extension. The input 
document is not relevant in this case.


> XPath in extensions gives runtime error
> ---------------------------------------
>
>          Key: XALANJ-2039
>          URL: http://issues.apache.org/jira/browse/XALANJ-2039
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan-extensions
>  Environment: Fedora 2 
>     Reporter: Marco Laponder
>     Assignee: Yash Talwar
>  Attachments: XPathExtension.java, xp.xsl
>
> 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)       

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to