Re: [xsl] Controlling Whitespace in IE

Subject: Re: [xsl] Controlling Whitespace in IE
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Fri, 5 May 2006 00:08:15 +0530
Hi Spencer,
 As a workaround, you can define the template <xsl:template match="def">
<xsl:template match="def">
  <a class="definition" href="something"><em><xsl:apply-templates/></em></a>
  <xsl:if test="local-name(following-sibling::node()[1]) = 'def'">
    <xsl:text> </xsl:text>


On 5/4/06, Spencer Tickner <spencertickner@xxxxxxxxx> wrote:
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"?>
       <sentencetext>blah <def>blah blah</def> blah blah <def>foo</def>

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"
<xsl:output media-type="html"/>

<xsl:variable name="cr"><xsl:text>

<xsl:template match="/">

<xsl:template match="sentencetext">
       <p><xsl:apply-templates/></p><xsl:value-of select="$cr"/>

<xsl:template match="def">
<a class="definition" href="something"><em><xsl:apply-templates/></em></a>

<xsl:template match="text()">
<xsl:when test="normalize-space(.) = ''"><xsl:text> </xsl:text></xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>


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.


Victoria BC, Canada

Current Thread