Subject: RE: find position of first occurrence in a node set
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 29 Jul 2005 23:00:44 +0100
|
> Anyway, you can use the xsl:number instruction to get what you want:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="/">
> <xsl:number select="transaction_set/segment[@type='HL']"/>
> </xsl:template>
>
> </xsl:stylesheet>
>
Note that the select attribute of xsl:number is new in XSLT 2.0. In 1.0 you
need
<xsl:for-each select="transaction_set/segment[@type='HL']">
<xsl:number/>
</xsl:for-each>
Michael Kay
http://www.saxonica.com/
|