[xsl] Two questions

Subject: [xsl] Two questions
From: "Tracey Zellmann" <tracey.zellmann@xxxxxxxxxxx>
Date: Tue, 11 Jul 2006 20:17:48 -0400
I have limited experience with XSLT, so please accept my beginner's stance.

The good news is that I am creating about 500 web pages, where I control the xml content and can do the transforms any way that is practical.

I am using SaxonB with java programs, 1.5.0_07.

Right now I have two particular problems: entities and a namespace issue.

First, I need to put some entity characters in the web pages, copyright for example.

This occurs on many of the pages, so I have put it in a template with other footer information. Using &copy; saxon gives me an error that the entity hasn't been declared. Trying &#169; saxon is OK, but I notice that the html page winds up with the actual copyright symbol, not the entity. It also is preceded by another character - B The web page then displays B)


What is the correct way to get entities onto the web page through a transform?


Second, my xml material has content that already has html tags. I have got that onto the pages using <xsl:copy-of .., but I am getting some additional namespace information.

example xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<HistoryPages>
<page seq="1">
<url>monumentSquareJarvisMap.html</url>
<title>Monument Square, 1810 - 1820, from a Map by Edward Jarvis</title>
<content>
<p>Edward Jarvis (1803-1884) was a physician</p>
</content>
</HistoryPages>

stylesheet
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
method="html" indent="yes" />
<xsl:include href="common.xsl"/>
<xsl:template match="page">
<html xmlns="http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>
<xsl:value-of select="title"/>
</title>
</head>
<body>
<xsl:copy-of select="content/p"/>
<xsl:call-template name="footerText"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


When I run this, I get the material under the p tag just as I desire, but I get <p xmlns=""> instead of just <p>

It displays successfully, but fails strict validation.
What is the correct way to do this?

Thanks for your help.

Current Thread