You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/02/25 22:56:25 UTC

DO NOT REPLY [Bug 17400] New: - org.apache.xpath.axes.AxesWalker getLastPos: duplicate predicate testing

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=17400>.
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=17400

org.apache.xpath.axes.AxesWalker getLastPos: duplicate predicate testing

           Summary: org.apache.xpath.axes.AxesWalker getLastPos: duplicate
                    predicate testing
           Product: XalanJ2
           Version: 2.4Dx
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xpath
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: dvoytenko@sectorbase.com


In class org.apache.xpath.axes.AxesWalker method getLastPos there's a fragment
of code:
 walker.setPredicateCount(walker.getPredicateCount() - 1);

Thus, in expression x[last() != position()][true()] first predicate is checked 
twice.

XML sample:
<?xml version="1.0" encoding="UTF-8"?>
<doc>
   <item>1</item>
   <item>2</item>
   <item>3</item>
</doc>

Result of 
 <xsl:copy-of select="/doc/item[last() != position()][true()]"/>

is
 <item>1</item>

and should be
 <item>1</item>
 <item>2</item>

XSL work-around:
 <xsl:copy-of select="(/doc/item[last() != position()])[true()]"/>

Java code fix: replace code line in org.apache.xpath.axes.AxesWalker getLastPos:
 walker.setPredicateCount(walker.getPredicateCount() - 1);
to
 walker.setPredicateCount(this.m_predicateIndex);