[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)

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

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

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 ?


Current Thread