You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Henry Zongaro (JIRA)" <xa...@xml.apache.org> on 2004/11/19 15:44:29 UTC

[jira] Resolved: (XALANJ-1754) Wrong evaluation of XPath expressions using key()

     [ http://nagoya.apache.org/jira/browse/XALANJ-1754?page=history ]
     
Henry Zongaro resolved XALANJ-1754:
-----------------------------------

    Resolution: Fixed

It looks like Igor Hersht fixed this problem in February, 2004, but neglected to add a remark to this defect report.  Xalan-J 2.6.0 should contain the fix for this problem.

> Wrong evaluation of XPath expressions using key()
> -------------------------------------------------
>
>          Key: XALANJ-1754
>          URL: http://nagoya.apache.org/jira/browse/XALANJ-1754
>      Project: XalanJ2
>         Type: Bug
>   Components: XPath
>     Versions: 2.5Dx
>  Environment: Operating System: Windows NT/2K
> Platform: PC
>     Reporter: Amir Rosen
>     Priority: Blocker
>  Attachments: test.xml, test.xsl
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org