xsl-list
[Top] [All Lists]

[xsl] Capturing position as a number

2009-03-18 14:07:18
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(_at_)vasont(_dot_)com>



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>