[xsl] Capturing position as a number

Subject: [xsl] Capturing position as a number
From: Charles Flanders <cflanders@xxxxxxxxxx>
Date: Wed, 18 Mar 2009 14:06:45 -0400
I need to capture an elements position as an integer to a variable so I can use that number in capture the text from another element that shares the same position number in another part of the tree.

My XML looks something like this:

<Document>
<CONDITION>
<HYPERPROC linkend="M16-66A.-HP1">Webbing straps removed</HYPERPROC>
</CONDITION>
<CONDITION>
<HYPERPROC linkend="M16-66A.-HP2">Remote Terminal Unit Removed</HYPERPROC></CONDITION>
</Document>


My template:


<xsl:template match="CONDITION">
<xsl:variable name="CurrentCond"><xsl:value-of select="CONDITION[position()]"/></xsl:variable>
<eqpconds>
<eqpconds-setup-item><condition><xsl:value-of select="."/></condition>
<itemref><link xmlns:xlink="http://www.w3.org/1999/xlink";>
<xsl:attribute name="linkaction">prompt</xsl:attribute>
<xsl:attribute name="linktype">goto</xsl:attribute>
<xsl:attribute namespace="http://www.w3.org/1999/xlink"; name="href">
<xsl:value-of select="//nameloc[$CurrentCond]/nmlist"/>
<xsl:text>.xml</xsl:text></xsl:attribute>
<xsl:attribute name="xreftype">wp</xsl:attribute><prompt><xsl:value-of select="."/>
</prompt></link>
</itemref>
</eqpconds-setup-item></eqpconds>
</xsl:template>


<xsl:template match="HYPERPROC"/>

Everything I've tried always returns the value of "1". I don't understand this, I have two CONDITION elements, shouldn't the second one have a position value of "2". Any help would be appreciated.






--


*Charles Flanders*


<mailto:cflanders@xxxxxxxxxx>


Current Thread