is it possible to use left angle bracket in xsl

Joined
Mar 26, 2011
Messages
1
Reaction score
0
I have tried to use the < and > token in

<xsl:if test="company = 'CBS &lt;&gt; Records'">

but still fail to run the xsl.

Is it possible to do it?

You can paste and test the code at here
http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog_if


Anyone can help, thanks!

Antony
:adore:

xml file
============================================================
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy?-->
<catalog>
  <cd>
  <title>Hide your heart</title>
  <artist>Bonnie Tyler</artist>
  <country>UK</country>
  <company>CBS <![CDATA[<>]]> Records</company>
  <price>9.90</price>
  <year>1988</year>
 </cd>
 <cd>
  <title>Greatest Hits</title>
  <artist>Dolly Parton</artist>
  <country>USA</country>
  <company>RCA</company>
  <price>9.90</price>
  <year>1982</year>
 </cd>
 <cd>
  <title>Still got the blues</title>
  <artist>Gary Moore</artist>
  <country>UK</country>
  <company>Virgin records</company>
  <price>10.20</price>
  <year>1990</year>
 </cd>
 <cd>
  <title>Unchain my heart</title>
  <artist>Joe Cocker</artist>
  <country>USA</country>
  <company>EMI</company>
  <price>8.20</price>
  <year>1987</year>
 </cd>
</catalog>




xls file
============================================================
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy?-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <h2>My CD Collection</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
      <th>Title</th>
      <th>Artist</th>
      <th>Company</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <xsl:if test="company = 'CBS &lt;&gt; Records'">
      <tr>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>
 <td><xsl:value-of select="company"/></td>
     </tr>
    </xsl:if>
    </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top