<xsl:template match="composition"> <h3> <xsl:number value="position()"/>. <xsl:value-of select="name"/> by <xsl:value-of select="composer"/> </h3> <ul> <xsl:if test="string(date)"> <!--not Y10K safe! --> <li><xsl:value-of select="substring(date,2,4)"/></li> </xsl:if> <xsl:if test="string(length)"> <li><xsl:value-of select="length"/></li> </xsl:if> <xsl:if test="string(instruments)"> <li><xsl:value-of select="instruments"/></li> </xsl:if> <xsl:if test="string(publisher)"> <li><xsl:value-of select="publisher"/></li> </xsl:if> </ul> <p><xsl:value-of select="description"/></p> </xsl:template>
The xsl:number
element has a variety of attributes to determine
number style, what's numbered, where numbering starts, and so forth
The position()
function returns the position of the current
node in the context node list