codedomino
Programmer
I want to check to see what the value in a column is and produce some xsl code based on that value.
I am using the following xsl:choose/when :
<xsl:choose>
<xsl:when test="entrydata[@columnnumber='0']/text/text()">
<xsl:choose>
<xsl:when test="entrydata[@columnnumber='0']/text = '0"> <- errors out here in browser
<xsl:element name="img">
<xsl:attribute name="src">rejected.gif</xsl:attribute>
<xsl:attribute name="alt">Rejected</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="entrydata[@columnnumber='0']/text = '1'">
<xsl:element name="img">
<xsl:attribute name="src">accepted.gif</xsl:attribute>
<xsl:attribute name="alt">Accepted</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl
therwise>
<xsl:element name="img">
<xsl:attribute name="src">inactivated.gif</xsl:attribute>
<xsl:attribute name="alt">Inactivated</xsl:attribute>
</xsl:element>
</xsl
therwise>
</xsl:choose>
</xsl:when>
<xsl
therwise>
<xsl:element name="img">
<xsl:attribute name="src">ecblank.gif</xsl:attribute>
<xsl:attribute name="height">1</xsl:attribute>
<xsl:attribute name="width">1</xsl:attribute>
<xsl:attribute name="alt" />
</xsl:element>
</xsl
therwise>
</xsl:choose>
Here is a sample of the xml it is working against:
<entrydata columnnumber="0" name="Status">
<text>1</text>
</entrydata>
The possible values are null, 1, and 2. and depending on the value I want to show a different icon.
I have gone over some books, w3c.org, xml.com and others and cannot find how to do this. Any help would be appreciated.
I am using the following xsl:choose/when :
<xsl:choose>
<xsl:when test="entrydata[@columnnumber='0']/text/text()">
<xsl:choose>
<xsl:when test="entrydata[@columnnumber='0']/text = '0"> <- errors out here in browser
<xsl:element name="img">
<xsl:attribute name="src">rejected.gif</xsl:attribute>
<xsl:attribute name="alt">Rejected</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="entrydata[@columnnumber='0']/text = '1'">
<xsl:element name="img">
<xsl:attribute name="src">accepted.gif</xsl:attribute>
<xsl:attribute name="alt">Accepted</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl
<xsl:element name="img">
<xsl:attribute name="src">inactivated.gif</xsl:attribute>
<xsl:attribute name="alt">Inactivated</xsl:attribute>
</xsl:element>
</xsl
</xsl:choose>
</xsl:when>
<xsl
<xsl:element name="img">
<xsl:attribute name="src">ecblank.gif</xsl:attribute>
<xsl:attribute name="height">1</xsl:attribute>
<xsl:attribute name="width">1</xsl:attribute>
<xsl:attribute name="alt" />
</xsl:element>
</xsl
</xsl:choose>
Here is a sample of the xml it is working against:
<entrydata columnnumber="0" name="Status">
<text>1</text>
</entrydata>
The possible values are null, 1, and 2. and depending on the value I want to show a different icon.
I have gone over some books, w3c.org, xml.com and others and cannot find how to do this. Any help would be appreciated.