Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

XSLT and XHTML DTD's (See related posts)

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: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" />


Another tidbit I found today was:

exclude-result-prefixes="media" 


to exclude unwanted namespace declarations from the output.

Comments on this post

JohnFrazer posts on Aug 04, 2007 at 12:36
Hmmmm.. I found using XSLT output method="html" produced the result I was looking for where I had declared application/xhtml+xml headers. Omitting xsl:output or using a method of xml did not provide HTML formatting.
Over 60% of the web is still using IE6/IE7 so guess we still have to consider them...

You need to create an account or log in to post comments to this site.