...

View Full Version : xsl:choose



Kusko
09-24-2008, 08:18 PM
I'm trying to change the color of the text content within a .xml file through my .xslt file; change it so it displays in red. Text content is within a <brandName registered="Bayer"> & other in <brandName registered="McNeil"> , same .xml file. Aside from the color i would also like to display the "()" around the company name.

I was trying something but it fails.. Never used it before so I'm probably using it the wrong way.

This is what I have for the colour change, and addition of brackets around company name within the .xslt:

<xsl:choose>
<xsl:when test="@registered='Aspirin'">
<font color="red">
<xsl:value-of select="@registered='(Bayer)'"/>
</font>
</xsl:when>
<xsl:when test="@registered='Tylenol'">
<font color="red">
<xsl:value-of select="@registered='(McNeil)'"/>
</font>
</xsl:when>
<xsl:otherwise>
<font style="bold">
<xsl:value-of select="@registered"/>
</font>
</xsl:otherwise>
</xsl:choose>

Any help is greatly appreciated.

shyam
09-25-2008, 08:14 PM
<xsl:choose>
<xsl:when test="@registered='Aspirin'">
<font color="red">
<xsl:value-of select="@registered='(Bayer)'"/>
</font>
</xsl:when>
<xsl:when test="@registered='Tylenol'">
<font color="red">
<xsl:value-of select="@registered='(McNeil)'"/>
</font>
</xsl:when>
<xsl:otherwise>
<font style="bold">
<xsl:value-of select="@registered"/>
</font>
</xsl:otherwise>
</xsl:choose>
what do you expect to get by giving a boolean condition for a value-of?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum