Hi,
I'm having trouble understanding how to use cdata-section-elements so text within XML element's attribute is ignored by the parser.
Here's the XML:
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
<Results xmlns:xsi=" xsi:noNamespaceSchemaLocation="
<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="<xslutput 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!
I'm having trouble understanding how to use cdata-section-elements so text within XML element's attribute is ignored by the parser.
Here's the XML:
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
<Results xmlns:xsi=" xsi:noNamespaceSchemaLocation="
<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="<xslutput 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!