gnom
06-27-2005, 04:19 PM
Here is a fragment of xml file:
<?xml version="1.0" <?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE logs [
<!ELEMENT logs (log*)>
<!ELEMENT log (query)>
<!ATTLIST log
type CDATA #REQUIRED
date CDATA #REQUIRED
time CDATA #REQUIRED>
<!ELEMENT query (#PCDATA)>
]>
and below is xsl file:
<xsl:for-each select="logs/log">
<xsl:sort select="@date" order="descending"/>
<table align="center" border="0">
<xsl:choose>
<xsl:when test="type=add">
<font color="#FF0000">
.......
</font>
</xsl:when>
<xsl:when test="type = modify">
<font color="#FFCC00">
...........
</font>
</xsl:when>
<xsl:when test="type = delete">
<font color="#99CC00">
.........
</font>
</xsl:when>
<xsl:otherwise>
<font>
.........
</font>
</xsl:otherwise>
</xsl:choose>
</table>
<br />
</xsl:for-each>
Now my problem is that for example xsl:when test="type = delete" doesn't work. The color is not changed. What is the proper way of comparing value of type tag with a string?
<?xml version="1.0" <?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE logs [
<!ELEMENT logs (log*)>
<!ELEMENT log (query)>
<!ATTLIST log
type CDATA #REQUIRED
date CDATA #REQUIRED
time CDATA #REQUIRED>
<!ELEMENT query (#PCDATA)>
]>
and below is xsl file:
<xsl:for-each select="logs/log">
<xsl:sort select="@date" order="descending"/>
<table align="center" border="0">
<xsl:choose>
<xsl:when test="type=add">
<font color="#FF0000">
.......
</font>
</xsl:when>
<xsl:when test="type = modify">
<font color="#FFCC00">
...........
</font>
</xsl:when>
<xsl:when test="type = delete">
<font color="#99CC00">
.........
</font>
</xsl:when>
<xsl:otherwise>
<font>
.........
</font>
</xsl:otherwise>
</xsl:choose>
</table>
<br />
</xsl:for-each>
Now my problem is that for example xsl:when test="type = delete" doesn't work. The color is not changed. What is the proper way of comparing value of type tag with a string?