|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Whitespace problem in IE5
Hello .
I'm transforming XML to HTML via XSL using IE5 too .
I put there Dave's solution with <xsl:script>, but it still strips the
whitespace.
Could You please look on my XML/XSL test files ?
What wrong here ?
XML :
<?xml version='1.0'?>
<?xml:stylesheet type="text/xsl" href="spaces1.xsl" xml:space="preserve"?>
<Screen >
<Spaces xml:space="preserve"> </Spaces>
<Field >This text should be shown with offset 20</Field>
</Screen>
XSL :
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<BODY xml:space="preserve" >
<xsl:apply-templates select="Screen"/>
</BODY>
</HTML>
</xsl:template>
<xsl:script><![CDATA[
function getText(e) {
return (e.text);
}
]]></xsl:script>
<xsl:template match="Screen">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="Field">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="text()"><xsl:value-of /></xsl:template>
<xsl:template match="Spaces">
<xsl:eval > getText(this) </xsl:eval>
</xsl:template>
</xsl:stylesheet>
Thanks ,
Orit .
----- Original Message -----
From: Dave Dieno <daved@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Thursday, May 20, 1999 7:14 PM
Subject: RE: Whitespace problem in IE5
> FYI:
>
> I managed to work around the problem in IE5 with some help from MSDN (see
> Controlling Whitespace :
> http://msdn.microsoft.com/xml/xslguide/xsl-whitespace.asp ).
>
> If you want to preserve the whitespace in your source document you have to
> specify the following attribute for those source document elements with
> whitespace, for example:
>
> <sourceline xml:space="preserve">
>
> This passes the whitespace through to the stylesheet.
>
> However, it seems that in IE5 the <xsl:value-of> element strips the
leading
> whitespace. When I looked at the text value of the <sourceline> node
using
> Jscript and the DOM I found a workaround.
>
> <xsl:template match="sourceline">
> <xsl:eval> getText(this) </xsl:eval>
> </xsl:template>
>
> <xsl:script><
Cart








