select only if immediate following sibling exists

Joined
Aug 2, 2006
Messages
1
Reaction score
0
I have the following XSL snippet:

<xsl:template match="change">
<span class="change"><xsl:attribute name="title">Change <xsl:value-of select="@chgno" />
<xsl:if test="following-sibling::strike[1]">
Previous text: <xsl:value-of select="following-sibling::strike" />
</xsl:if>
</xsl:attribute><span style="color:#666666;">'</span><span style="position: absolute; top: auto; right:1.1em; color:#660000; font-weight:bolder;">l</span><xsl:apply-templates /><span style="position: absolute; top: auto; right:1.1em; color:#660000; font-weight:bolder;">l</span><span style="color:#666666;">'</span></span>
</xsl:template>

Givent the following XML snippet:

<para>...companies serve approximately <change chgno="2">4 million customers</change> through direct insurance operations in Germany, <change chgno="2">Paraguay</change> <strike>Paragay</strike>, Peru, China, Poland, Mexico, India...<para>

I want to only display a title when the next immediate sibling is the strike element. This code will display title the same for both the first change and the second change element in the snippet above. What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top