Re: [xsl] XML to HTML transform validation problem

Subject: Re: [xsl] XML to HTML transform validation problem
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Fri, 26 May 2006 08:22:30 +0100
If you're not using nodes in the namespace in your output than add exclude-result-prefixes="xs" to your stylesheet element.


----- Original Message ----- From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, May 26, 2006 7:56 AM
Subject: [xsl] XML to HTML transform validation problem

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
("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:xs=""; >
<xsl:output method="html" encoding="ISO-8859-1" indent="no"
  doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
  doctype-system=""; />

<xsl:template match="/document">
  <title><xsl:value-of select="title" /></title>

I am putting the generated HTML through the HTML validator (at and getting errors; the first of which is

 Error: there is no attribute "XMLNS:XS".
 <html xmlns:xs="";><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


Current Thread