Content with Style

Web Technique

XSL and DTD

by Pascal Opitz on April 12 2006, 10:05

A quick code snippet to include the right XHTML DTD in your XSL generated output. This took me a bit of reseach to find out:

<xsl:text disable-output-escaping="yes">
<![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]]>
</xsl:text>

Include this into you template and switch the output method to “xsl” and you should be fine.

Comments

  • this is simpler:

    <xsl:output
    method="xml"
    encoding="utf-8"
    omit-xml-declaration="yes"
    indent="no"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
    

    by Anup Shah on April 11 2006, 08:12 #

  • Thanks a lot Anup, it definitely is … but even more important: it's way cleaner!

    by Pascal Opitz on April 11 2006, 08:22 #

  • Another tidbit I found today was: exclude-result-prefixes="media" to exclude unwanted namespace declarations from the output. Handy…

    by Mike Stenhouse on April 17 2006, 09:58 #