You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by jeff <jl...@houseofdistraction.com> on 2000/10/25 22:14:23 UTC

position() and last() broken?

I was trying to put an <hr> in between each item in a list when
rendering to html using stylebook and xalan-j_2_0_D01.  I used a
construct I found at
http://www.w3.org/TR/xslt#section-Conditional-Processing-with-xsl:if but
it didn't work.

With this template

<xsl:template match="item">
    <xsl:apply-templates/>
    <xsl:value-of select="position()"/>,
    <xsl:value-of select="last()"/>
    <xsl:if test="not(position()=last())">
      <hr/>
    </xsl:if>
</xsl:template>

and this input fragment

<itemlist>
  <item>item 1</item>
  <item>item 2</item>
  <item>item 3</item>
</itemlist>

I get this output fragment

item 1
2,7<HR>

item 2
4,7<HR>

item 3
6,7<HR>