I have the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd>
<title>title1</title>
</cd>
<cd>
<title>title1</title>
</cd>
<cd>
<title>title2</title>
</cd>
<cd>
<title>title2</title>
</cd>
<cd>
<title>title2</title>
</cd>
<cd>
<title>title2</title>
</cd>
<cd>
<title>title4</title>
</cd>
<cd>
<title>title5</title>
</cd>
</catalog>
Is there a way to know the position of the first <cd>
that contains title2 ?
i have tryed with
<xsl:value-of select="count(catalog/cd[contains(., 'title2')])"/>
and
<xsl:value-of select="count(catalog/cd[./title='title2']/preceding-sibling::*)" />
but they counts nodes that contains title2