[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

comparison of strings having single quote

Subject: comparison of strings having single quote
From: Pemmaraju Phani Kumar <pkumar3@xxxxxxxx>
Date: Fri, 15 Feb 2002 11:29:55 +0100
comparison of strings
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.