-
Problem with XML and cdata-section-elements
Hi,
I'm having trouble understanding how to use cdata-section-elements so text within XML element's attribute (title and description) is ignored by the parser.
XML is generated by a third party and I have no control on its content, so description attribute can can contain &.
I need the parser to ignore the content of title and description.
Here's the XML:
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
<Results xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://dtd.overture.com/schema/affiliate/2.8.3/OvertureSearchResults.xsd">
<ResultSet id="ID 1" numResults="5" Rating="G">
<Listing title="Title 1" description="Text containing &">
</Listing>
</ResultSet>
</Results>
XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl utput cdata-section-elements="td"/>
<xsl:template match="/">
<html>
<body>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
</tr>
<xsl:for-each select="Results/ResultSet/Listing">
<tr>
<td><xsl:value-of select="@title"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
If anyone could tell me what I'm doing wrong, it will be much appreciated.
Thanks!
Similar Threads
-
Replies: 4
Last Post: 07-23-2008, 01:10 AM
-
By James Evans in forum XML
Replies: 1
Last Post: 03-04-2002, 07:07 PM
-
Replies: 0
Last Post: 10-27-2001, 03:34 PM
-
Replies: 0
Last Post: 10-04-2001, 01:10 AM
-
Replies: 4
Last Post: 05-30-2001, 06:17 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|