RE: [xsl] doubt

Subject: RE: [xsl] doubt
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 7 Apr 2005 09:06:47 +0100
>    I am having the xml file in this format.
> 
> <question  correctid="3" Qno="370" >
>    <stmt1 mgif1="" mgif="" misc="" >Kepler's first law of 
> planetary motion  is also called </stmt1>
>    <stmt2 mgif1="" mgif="" misc="" />
>    <opt mgif1="" mgif="" voiceover="" >law of periods</opt>
>    <opt mgif1="" mgif="" voiceover="" >law of areas</opt>
>    <opt mgif1="" mgif="" voiceover="" >law of orbits</opt>
>    <opt mgif1="" mgif="" voiceover="" >law of distances</opt>
>   </question>
> 
> 
> For example, If the correct id number value is 3 the law of 
> orbits value 
> should appear in different color. so according the correct id 
> the color of 
> the option should get changed. Is it possible to do ?
> 

Not a very useful subject line.

Yes, use logic like the following, with opt as the context node:

<xsl:if test="../@correctId = count(preceding-sibling::opt)+1">
  <xsl:attribute name="colour">pink</xsl:attribute>
</xsl:if>

Michael Kay
http://www.saxonica.com/

Current Thread