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=25783>. 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=25783 Wrong evaluation of XPath expressions using key() Summary: Wrong evaluation of XPath expressions using key() Product: XalanJ2 Version: 2.5Dx Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Major Priority: Other Component: org.apache.xalan.xsltc AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] key() expressions using 2 filters sometimes return the wrong result (sometimes return an empty nodeset and sometimes return the source document root) for example the expression: (key('object','obj1')[true()])[1] should return the first node that matches the key (if such) when in fact it returns the source document root. test case: ---------- XML: <?xml version="1.0" encoding="UTF-8"?> <objects> <object name="obj1"/> </objects> XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" encoding="UTF-8"/> <xsl:key name="object" match="objects/object" use="@name"/> <xsl:template match="/"> <body> <xsl:copy-of select="(key('object','obj1')[true()])[1]"/> </body> </xsl:template> </xsl:stylesheet> RESULT: <?xml version="1.0" encoding="UTF-8"?> <body> <objects> <object name="obj1"/> </objects> </body> EXPECTED RESULT: <?xml version="1.0" encoding="UTF-8"?> <body> <object name="obj1"/> </body> ---------------------------------------- For automatically generated XSLT it is sometimes very difficult to avoid such expressions from being generated - so just not using this kind of expressions is not a good solution or workaround.
