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

position() returns zero under apply-imports

           Summary: position() returns zero under apply-imports
           Product: XalanJ2
           Version: 2.3
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Based on a report from Kai Ojansuu, I wrote the position102 test that has this
template:
<xsl:template match="c">
  <xsl:text>
</xsl:text>
  <apply level="main">
    <xsl:text>Item </xsl:text>
    <xsl:value-of select="@mark"/>
    <xsl:text> is in position </xsl:text>
    <xsl:value-of select="position()"/>
  </apply>
  <xsl:apply-imports/>
</xsl:template>
and the apply-imports will invoke this:
<xsl:template match="c">
  <xsl:text>
</xsl:text>
  <apply level="import">
    <xsl:text>Item </xsl:text>
    <xsl:value-of select="@mark"/>
    <xsl:text> is in position </xsl:text>
    <xsl:value-of select="position()"/>
  </apply>
</xsl:template>

While the template at the main level returns positions of 1, 2, 3 for the c
elements, the imported one returns 0, 0, 0.

XSLT section 5.6 is a little terse, so we have to guess at the WG's intent.
I'll report an erratum to the WG.

WORKAROUND: Determine the position in the main-level template. Set a variable
to hold it, if necessary.

Reply via email to