Re: [xsl] XHTML html validation

Subject: Re: [xsl] XHTML html validation
From: Abel Braaksma <>
Date: Fri, 16 Feb 2007 12:58:14 +0100
John Steel wrote:

One more thing: if you want to force a certain string on the beginning of your file, you can use a trick with character-maps in XSLT 2 to get it there. I've put a workaround on this or saxon's list a while ago, but it is easy enough to implement.
Thanks, looks like I need this.

Here's a stylesheet that illustrates that solution. Note, this is an *UGLY* workaround for non-conforming XSLT 2 processors to hack around a bug. You really should use the declaration in my previous post if your processor can handle it.

<xsl:stylesheet version="2.0"
<xsl:output method="xml" use-character-maps="doctype"/>
<xsl:character-map name="doctype" >
string='&lt;!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"";>' />
<xsl:template match="/" name="main">

-- Abel Braaksma

Current Thread