RE: Whitespace problem

Subject: RE: Whitespace problem
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Wed, 16 Jun 1999 14:52:21 +0100
>Richard Lander said:
> I am having quiet a bit of trouble with whitespace.> 
> My question: How do I force XSL to strip out the carriage 
> returns in the
> text of an element? I am using the 1998-12-16 draft, as I want to stay
> compatible with IE5.

First note that strip-space doesn't do anything to newlines adjacent to text
(it took me a long time to grasp this). It only affects spaces and newlines
that are surrounded by tags on both sides. It will remove the newline
between the tags here:

<atag/>
<btag/>

but will leave two newlines here:

<atag/>
Some text with a newline before and after
<btag/>

If you want to remove the newlines in the latter, use normalize(). But
that's not in the Dec 16 draft nor, as far as I know, in IE5.

As James Clark clarified to me in response to a query, (the spec is not
entirely clear on the point), "stripping a node" means removing the node
from the tree, not removing spaces from the node.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread