Test first subnode from node.
- by Kalinin
XML:
<cont>
<mode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
</mode>
<mode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
</mode>
<mode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
<submode>lorem ipsum</submode>
</mode>
</cont>
How to test first <submode> from each <mode> in such construction:
<xsl:template match="submode">
<xsl:if test="(parent::mode) and (...what?...)">
...
</xsl:if>
...
</xsl:template>
I do not understand how use position() here.