Hi Spencer,
The solution which Mukul gave to you, seems to work in general:
you can "append" whitespace to element-nodes but not to
text-nodes. Oddly enough, there is also a differemce in whitespace
handling for output indent="no" and indent="yes": only "no"
eliminates all whitespace.
Regards, Manfred
On 04/05/06, Martin Gadbois <martin(_dot_)gadbois(_at_)colubris(_dot_)com>
wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Spencer Tickner wrote:
> 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
I would try to use
<xsl:text xml:space="preserve"> </xsl:text>
That may does the trick.
- --
============== +----------------------------------------------+
Martin Gadbois | "Windows might take you from 0 to 60 faster, |
S/W Developer | but to go to 100 you need Unix." |
Colubris Networks Inc. +----------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEWkoZ9Y3/iTTCEDkRAmQ7AJ0WKN21xuCcnRxCnP0guX6M7BuNpQCeI7Sf
DlEz9I7SCmWXMzGIE45EnDs=
=olG9
-----END PGP SIGNATURE-----
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--