PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL BE LOST SOMEWHERE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3420 *** shadow/3420 Tue Sep 4 13:54:02 2001 --- shadow/3420.tmp.29044 Tue Sep 4 13:54:02 2001 *************** *** 0 **** --- 1,78 ---- + +============================================================================+ + | xsltc fails conf test position68 problem with position() in for-each | + +----------------------------------------------------------------------------+ + | Bug #: 3420 Product: XalanJ2 | + | Status: NEW Version: CurrentCVS | + | Resolution: Platform: All | + | Severity: Critical OS/Version: All | + | Priority: Other Component: org.apache.xalan.xsltc | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + This may be a duplicate, because I'd be surprised if this problem hasn't been + found before. Basically, this test shows that xsltc is returning 1 for the + position of the context node within a for-each loop for every iteration. + Maybe there is something about the match expression that selects the node + set that is unusual. + + Here are the details. + + Expected Output + --------------- + <?xml version="1.0" encoding="UTF-8"?> + <out>MSFT13,IBM23,Lotus33</out> + + + Obtained Output + --------------- + <?xml version="1.0" encoding="utf-8" ?> + <out>MSFT13,IBM13,Lotus13,</out> + + Note: the "1" after MSFT, IBM, and Lotus comes from the position() + function. So it is incorrectly saying the position is 1 for + all three nodes. + + position68.xsl + -------------- + <?xml version="1.0"?> + <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + + <!-- FileName: position68 --> + <!-- Document: http://www.w3.org/TR/xpath --> + <!-- DocVersion: 19991116 --> + <!-- Section: 2.4 --> + <!-- Creator: Paul Dick --> + <!-- Purpose: Test positional indexing with for-each loop and all-but-last + xsl:if for comma. --> + + <xsl:template match="metadata"> + <out> + <xsl:for-each select="keyword[@tag='ticker']"> + <xsl:value-of select="@value"/> + <xsl:value-of select="position()"/> + <xsl:value-of select="last()"/> + <xsl:if test="position()!=last()">,</xsl:if> + </xsl:for-each> + </out> + </xsl:template> + + </xsl:stylesheet> + + + position68.xml + -------------- + <?xml version="1.0"?> + <metadata> + <keyword tag="ticker" value="MSFT"/> + <keyword tag="sector" value="unitedstates"/> + <keyword tag="ticker" value="IBM"/> + <keyword tag="ticker" value="Lotus"/> + <SUMMARY>tetettete</SUMMARY> + <CLASSIFICATION state="immediate"/> + <IPTYPE_REF majorName="Earn" minorName="announcement"/> + </metadata>
