Created
December 14, 2009 16:33
-
-
Save cowboy/256183 to your computer and use it in GitHub Desktop.
IE conditional comment <body> tag in XSLT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| IE conditional comment <body> tag in XSLT | |
| 5/28/2010 "Cowboy" Ben Alman | |
| http://benalman.com | |
| See: | |
| http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ | |
| --> | |
| <xsl:template name="html_body"> | |
| <xsl:variable name="body_class" select="'optional classes'"/> | |
| <xsl:value-of select="concat( | |
| '<!--[if lt IE 7]><body class="ie ie6 lte9 lte8 lte7 ',$body_class,'"><![endif]-->
', | |
| '<!--[if IE 7]><body class="ie ie7 lte9 lte8 lte7 ',$body_class,'"><![endif]-->
', | |
| '<!--[if IE 8]><body class="ie ie8 lte9 lte8 ',$body_class,'"><![endif]-->
', | |
| '<!--[if IE 9]><body class="ie ie9 lte9 ',$body_class,'"><![endif]-->
', | |
| '<!--[if gt IE 9]><body class="ie gt9 ',$body_class,'"><![endif]-->
', | |
| '<!--[if !IE]>' | |
| )" disable-output-escaping="yes"/> | |
| <body> | |
| <xsl:attribute name="class"> | |
| <xsl:value-of select="$body_class"/> | |
| </xsl:attribute> | |
| <xsl:value-of select="'<![endif]-->'" disable-output-escaping="yes"/> | |
| ...body... | |
| </body> | |
| </xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
XSD / XSLT - noooooooooooooooooooooooooooo