[thelist] Embedding HTML DocType into an XSL Document....

Anthony Baratta anthony at baratta.com
Fri May 19 17:10:05 CDT 2006


I don't know why I've never encountered this before today and I can't seem to google up an answer to this question:

How do you embed the HTML DocType into an XSL Document that will be transformed with XML data and sent to a browser?? Normally, I'm transforming sections of pages or data lists - but for one page I'm now transforming the whole page. Since I have a DocType at the top of every HTML page, the transformation barfs because the HTML doctype is not expected that far down the page....e.g.

[?xml version="1.0" encoding="iso-8859-1"?]
[xsl:stylesheet version="1.0"
    [xsl:output method="html" indent="no" media-type="text/html" version="4.0"/]

    [xsl:template match="/"]
        [!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

The above generates a dotNet error: Unexpected DTD declaration during the transformation. I've tred wrapping the DocType in a CDATA tag, but that causes the angle brackets to be converted to & epuiv and the DocType then prints out on the web page.

So any pointers? Thanks in advance!

More information about the thelist mailing list