[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Conditional test is failing


Subject: RE: [xsl] Conditional test is failing
From: "Sreeni Yetchina -X \(syetchin - Pure Solutions at Cisco\)" <syetchin@xxxxxxxxx>
Date: Thu, 16 Mar 2006 11:59:06 -0800

Hi Gowri,
Please find the corrected code here.

----------------------------
<h2>Electrical characteristics Process = <xsl:variable name="strength"
select="macro/CV/electrical/PTV/strength"/>
<xsl:choose>
  <xsl:when test="$strength = 'W'">
   Weak
 </xsl:when>
 <xsl:when test="$strength = 'N'">
   Nominal
 </xsl:when>
 <xsl:otherwise>
   Strong
 </xsl:otherwise>
</xsl:choose>
</h2>
--------------
Good luck,
Sreeni

-----Original Message-----
From: Gowri Ratakonda [mailto:gratakonda@xxxxxxxxx]
Sent: Thursday, March 16, 2006 11:55 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Conditional test is failing


I am using <xsl:choose> to replace these values in the XML file:

W, N, S

with these in the output HTML:

Weak, Nominal, Strong

Need help to figure out why my conditional statement is picking the last
value in the <xsl:choose> block all the time.

My XMl file looks like this:

<macro>
 <macro_name>NRTCLDFFBQ_F1_SNPM</macro_name>
 <library>GS60</library>
 <CV>
   <Vdd>1.35</Vdd>
   <size>9.875</size>
   <electrical>
     <slew>
        <value>2</value>
        <units>PS</units>
     </slew>
     <PTV>
        <strength>N</strength>
        <voltage>1.35</voltage>
        <temp>25</temp>
     </PTV>
     .
     .
     .
   </electrical>
 </CV>
</macro>
-------------------------------------------------

Here is my code for the <xsl:choose> element:

<h2>Electrical characteristics Process = <xsl:variable name="strength"
select="macro/CV/electrical/PTV/strength"/>
<xsl:choose>
 <xsl:when test='$strength = W'>
   Weak
 </xsl:when>
 <xsl:when test='$strength = N'>
   Nominal
 </xsl:when>
 <xsl:otherwise>
   Strong
 </xsl:otherwise>
</xsl:choose>
</h2>
----------------------------------------------------

Instead of 'Nominal', I get 'Strong' in my output file.
Could someone please tell me what's wrong with my code?

Thanks,
Gowri



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Current Thread
Keywords
xml