Earlier today, I wrote a bit about how to get :hover to work in IE7. The solution involved making sure the appropriate DOCTYPE was set.
Well, what happens if you're working with XML and want to use an XSLT, but still want to be sure the output will keep you out of IE7's quirks mode?
At first glance, you might think you don't have any control over the DOCTYPE, since your transformation will likely barf if you try to include a DOCTYPE explicitly. Fortunately, the XSLT spec provides several output methods for you to choose from. In dealing with HTML and XHTML, you'll most likely be interested in the HTML output method and XML output method, respectively.
XML to XHTML Transformations with XSLT Processors gives a really nice rundown on how you can specify your desired DOCTYPE from within your XSLT. For instance, if you wanted to use the HTML 4.01 Strict DOCTYPE that was one of the options for keeping IE7 out of quirks mode, you'd include the following in your XSLT:
<xsl:output method="html" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML 4.01//EN" indent="yes" />
So there you have it, an easy way to make sure your XSLT output conforms to the DOCTYPE of your choosing.
Comments
very helpful. Thanks
Thanks, that's exaclty what I was looking for.
thanks a lot for this information!
Thank you very much! It helped a lot!
Infinite thanks, you're the man.
Muchas gracias!
exactly what I was looking for. Very helpful, thank you very much.
You are a God amongst men, helping me vanquish the evils of IE! THANK YOU!
I love you.
Post Comments
If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.
You just saved me hours of work. Thanks.
Permalink