[xsl] XSLT in IE (MSXML3)

Subject: [xsl] XSLT in IE (MSXML3)
From: "Manfred Staudinger" <manfred.staudinger@xxxxxxxxx>
Date: Mon, 25 Jun 2007 17:08:13 +0200
Hi list,

I've written a summary what problems may arise when using
client side XSLT with IE. Tested with IE6 and MSXML3 on
Win2000, it has the form of a stylesheet, to make it ease to
test on different platforms, browser levels and versions of
MSXMLx. Any comments or additions are most welcome!

Regards, Manfred

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="Test_IE_view.xsl" type="text/xsl"?>
<doc xmlns="http://www.w3.org/1999/xhtml";>
	<div style="display: none"/>

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"

<xsl:output method="xml"
	doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
	encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="node() | @*">
		<xsl:apply-templates select="node() | @*"/>

<xsl:template match="xhtml:doc">
<xsl:comment>in IE-6 below is the same for xsl:output method="xml" or
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>Testing XSLT in IE (MSXML3)</title>
	<style type="text/css">
#div11, #div12 {background: red; width: 200px; height: 6px; border:
4px solid black; overflow:hidden;}
#div11 {border-width: 6px 40px;}
#div12 {border-width: 6px 0px;}
	<h2>Testing XSLT in IE (MSXML3)</h2>
	<p>As IE strips whitespace before the XSLT processing starts, it may be worth
		to consider &lt;xsl:strip-space elements="*"/> for a cross-browser
	<p>IE seems to ignore xsl:output encoding="UTF-8" and produces
		&lt;?xml version="1.0" encoding="UTF-16"?> for the xml header (maybe
		without negative consequences).</p>
	<div id="div11"></div>
	<p>same length for quirks-mode (for xsl:output method="xml" and
		ommited or ="no")</p>
	<div id="div12"></div>
	<p>Using xsl:output method="html" or "xml" seems to make no difference for the
		following tests. First, the elements come from the <b>input document</b>:
			<li>with xsl:output  indent="yes"  CRLF (hex 0D0A) may be inserted
                               between elements, even in places where
no whitespace was in the
                               source. Strongly recommended:
xsl:output  indent="no"</li>
			<li>the &lt;br/> element becomes &lt;br>CRLF&lt;/br>, giving you an extra
				newline. To eliminate the extra newline you might use &lt;xsl:template
				match="xhtml:br"> &lt;br/> &lt;/xsl:template></li>
			<li>the &lt;div style="display: none"/> becomes &lt;div style="display:
	<p>Second, the elements come from the <b>stylesheet</b>:
			<li>no CRLF (hex 0D0A) will be inserted</li>
			<li>&lt;br/> correctly becomes &lt;br /></li>
			<li>&lt;div style="display: none"/> becomes &lt;div style="display: none" />,
				causing IE to skip all content which comes after it (here
                               &lt;p>text6&lt;/p>). To avoid this,
simply code &lt;div style="display:
	<div style="display: none"></div>
	<div style="display: none"/>

<xsl:template match="/">
	<xsl:apply-templates select="xhtml:doc"/>


Current Thread