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=6665>. 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=6665 ArrayIndexOutOfBoundsException on variable usage in XPath expression Summary: ArrayIndexOutOfBoundsException on variable usage in XPath expression Product: XalanJ2 Version: 2.3Dx Platform: Other OS/Version: Other Status: NEW Severity: Major Priority: Other Component: org.apache.xalan.xsltc AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] When processing the simplified stylesheet below I get the exception below when processing what is an empty response from my application layer. I've pasted in the xsl and two xml files below. The empty response dies (1>=1) and the minimal response works. It seems from my experiments that it is caused by the usage of a variable within an XPath expression as a more complex XPath expression doing the same thing (commented out in my XSL) actually works. My reasoning for using variable is that it would be used in more complex processing further on in my stylesheet. This works fine with Saxon. java.lang.ArrayIndexOutOfBoundsException: 1 >= 1 at java.util.Vector.removeElementAt(Vector.java:521) at org.apache.xalan.xsltc.runtime.AbstractTranslet.popVarFrame (AbstractTranslet.java:264) at commissionPlacementHtmlReportBug.applyTemplates() at commissionPlacementHtmlReportBug.transform() at org.apache.xalan.xsltc.runtime.AbstractTranslet.transform (AbstractTranslet.java:547) at org.apache.xalan.xsltc.cmdline.Transform.doTransform (Transform.java:210) at org.apache.xalan.xsltc.cmdline.Transform.main(Transform.java:329) Translet error(s): 1 >= 1 XSL---------------------------------------------------------------- ------------------------------------------------------------------- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:output method="xml" indent="yes"/> <xsl:key name="allPlacementIds" match="/CommissionPlacementReport/PlacementDetails/Row" use="PlacementId"/> <xsl:variable name='uniquePlacementIds' select='/CommissionPlacementReport/PlacementDetails/Row[ generate-id(PlacementId)=generate-id(key("allPlacementIds",PlacementId) [1]/PlacementId)]'/> <xsl:template match="/"> <xsl:for-each select="$uniquePlacementIds"> <xsl:variable name="currentPlacementId" select="PlacementId"/> <!-- THIS WORKS --> <!-- <xsl:for-each select="/CommissionPlacementReport/PlacementDetails/Row[current ()/PlacementId=./PlacementId]"> --> <!-- This Dies 1>=1 --> <xsl:for-each select="/CommissionPlacementReport/PlacementDetails/Row [PlacementId=$currentPlacementId]"> <out><xsl:value-of select="PlacementId"/></out> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet> EMPTY XML---------------------------------------------------------- ------------------------------------------------------------------- <CommissionPlacementReport> </CommissionPlacementReport> MINIMAL XML-------------------------------------------------------- ------------------------------------------------------------------- <CommissionPlacementReport> <PlacementDetails> <Row> <PlacementId>1</PlacementId> </Row> <Row> <PlacementId>2</PlacementId> </Row> </PlacementDetails> <LandingPageDetails> <Row> <SiteId>99999</SiteId> <PlacementId>1</PlacementId> </Row> <Row> <SiteId>99999</SiteId> <PlacementId>2</PlacementId> </Row> </LandingPageDetails> </CommissionPlacementReport>
