[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Controlling Whitespace in IE

Subject: RE: Controlling Whitespace in IE
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 4 May 2006 19:08:04 +0100
whitespace in ie
Sadly, IE throws the space away before invoking the XSLT processor.

Complaining to Microsoft is unlikely to do much good.

If you invoke the transformation from Javascript rather than via the
<?xml-stylesheet?> processing instructions, there are magic incantations
that cause the whitespace to be preserved.

Michael Kay

> -----Original Message-----
> From: Spencer Tickner [mailto:spencertickner@xxxxxxxxx] 
> Sent: 04 May 2006 18:55
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Controlling Whitespace in IE
> Hi Everyone,
> Thanks in advance for the help.
> I'm having an issue with ie's translation of my xml document. 
> With this document:
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <root>
> 	<sentencetext>blah <def>blah blah</def> blah blah 
> <def>foo</def> <def>bar</def>.</sentencetext> </root>
> the foo and the bar are stuck together. I am using this 
> stylesheet to try and force them apart:
> <?xml version='1.0'?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output media-type="html"/>
> <xsl:variable name="cr"><xsl:text>
> </xsl:text></xsl:variable>
> <xsl:template match="/">
> 	<html>
> 	<body>
> 	<xsl:apply-templates/>
> 	</body>
> 	</html>
> </xsl:template>
> <xsl:template match="sentencetext">
> 	<p><xsl:apply-templates/></p><xsl:value-of 
> select="$cr"/> </xsl:template>
> <xsl:template match="def">
> <a class="definition" 
> href="something"><em><xsl:apply-templates/></em></a>
> </xsl:template>
> <xsl:template match="text()">
> <xsl:choose>
> <xsl:when test="normalize-space(.) = ''"><xsl:text> 
> </xsl:text></xsl:when> <xsl:otherwise><xsl:value-of 
> select="."/></xsl:otherwise> </xsl:choose> </xsl:template>
> </xsl:stylesheet>
> IE does not seem to be translating the normalize-space 
> funtion correctly.
> For instance, when I put a 1 before the <xsl:text> 
> </xsl:text> in firefox I get 1's exactly where I would expect 
> them and foo and bar are seperated by a space. However in IE, 
> no 1's appear. Does anybody know of a hack or work around for this.
> Thanks,
> Spencer
> Victoria BC, Canada

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.