[xsl] How to do this in xsl

Subject: [xsl] How to do this in xsl
From: T UmaShankari <umashankari@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 27 Mar 2005 11:22:55 +0530 (IST)
Hello,

  I am new to this..
I have a set of statements like this..

<opt mgif1="hai" mgif="" voiceover="" >Rani Lakshmi Bai |test1\ Nana Saheb</opt>
<opt mgif1="" mgif="" voiceover="" >Nana Saheb |test2\ Maruthu Brothers</opt>
<opt mgif1="" mgif="" voiceover="" >Maruthu Brothers |test3\ Tantia Tope</opt>


I need to display the contents which is inside the |to\ in different color. i have used this code for doing that..

<xsl:template match="//opt">
<font color="black">
<xsl:variable name="stringfirst">
<xsl:value-of select="substring-before(//opt,'|')"/>
</xsl:variable>
<xsl:value-of select="$stringfirst"/>
</font>
<font color="red">
<xsl:variable name="stringmid">
<xsl:value-of select="substring-after(substring-before(//opt,'\'),'|')" />
</xsl:variable>
<xsl:value-of select="$stringmid"/>
</font>

<font color="black">
<xsl:variable name="stringlast">
<xsl:value-of select="substring-after(//opt,'\')"/>
</xsl:variable>
<xsl:value-of select="$stringlast"/>
</font>


but it is displaying the o/p like this..


statement1 option1 statement1
statement1 option1 statement1

It is not going to the second statement. Can any one plese tell me how to do this ?

Regards,
Uma

Current Thread