[xsl] XML to HTML transform validation problem

Subject: [xsl] XML to HTML transform validation problem
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Fri, 26 May 2006 18:56:31 +1200
I have a set of XML documents and a standard XML-HTML transformation which
is run in a pipeline; the XSL processor is Saxon 8.6.n (can't check at the
moment, but I think n=1).

Because of the way the stylesheet needs to process footnotes I have to use
some XSL 2.0 features, hence there is some typing in the stylesheet
(..as="xs:integer"..) and the stylesheet has to declare the xs namespace.

========= XSL ========
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:xs="http://www.w3.org/2001/XMLSchema"; >
<xsl:output method="html" encoding="ISO-8859-1" indent="no"
   doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
   doctype-system="http://www.w3.org/TR/html4/loose.dtd"; />

<xsl:template match="/document">
<html>
<head>
   <title><xsl:value-of select="title" /></title>
</head>
<body>
   ...etc...
</body>
</html>
...etc...
=====================

I am putting the generated HTML through the HTML validator (at
http://validator.w3.org) and getting errors; the first of which is

  Error: there is no attribute "XMLNS:XS".
  <html xmlns:xs="http://www.w3.org/2001/XMLSchema";><head><title...

If I drop the xmlns:xs declaration from my stylesheet (and comment out the
2.0 features it uses) then the <html> element does not declare the
namespace, but this isn't the right answer! I can see plenty of example HTML
outputs on the standard XSL websites which declare the same namespace, so
what additional step do I have to take to produce output which validates? I
can't believe that everybody's examples would fail the validation tests, so
obviously I've missed something.

Thanks for any help

Cheers
Trevor

Current Thread