Subject: [xsl] comparison of strings having single quote From: Pemmaraju Phani Kumar <pkumar3@xxxxxxxx> Date: Fri, 15 Feb 2002 11:29:55 +0100 |
Hi I have the following xml & xsl files. I would like to get the ARTIST which has only - Sri's -. How to do it. The main problem is with the single quote handling. The when match condition given below fails. Thanks Phani <---xml file begin---> <?xml version="1.0" encoding="ISO8859-1" ?> <CATALOG> <CD> <TITLE>Maharaja</TITLE> <ARTIST>Kumars</ARTIST> <COUNTRY>India</COUNTRY> <COMPANY>MGM</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>King Kong</TITLE> <ARTIST>Sri's</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Tseries</COMPANY> <PRICE>20</PRICE> <YEAR>1995</YEAR> </CD> <CD> <TITLE>PA </TITLE> <ARTIST>Sri's </ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Baan </COMPANY> <PRICE>72000</PRICE> <YEAR>2002</YEAR> </CD> <CD> <TITLE>Bad</TITLE> <ARTIST>Michael Jackson </ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>MGM</COMPANY> <PRICE>20.00</PRICE> <YEAR>1985</YEAR> </CD> </CATALOG> <---xml file ends--> <---xsl file begin---> <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body> <table border="2" bgcolor="yellow"> <tr> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="CATALOG/CD" order-by=" + ARTIST"> <tr> <xsl:choose> <xsl:when match=".[ARTIST='Sri's']"> <td bgcolor="#ff0000"><xsl:value-of select="TITLE"/></td> <td bgcolor="#ff0000"><xsl:value-of select="ARTIST"/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="TITLE"/></td> <td><xsl:value-of select="ARTIST"/></td> </xsl:otherwise> </xsl:choose> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> <---xsl file ends---> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] local-name of attribute v, Trevor Nash | Thread | Re: [xsl] comparison of strings hav, Jeni Tennison |
RE: [xsl] xsl:include with plain te, Chris Bayes | Date | Re: [xsl] local-name of attribute v, Trevor Nash |
Month |