RE: [xsl] Fwd: Over/under trimming of whitespace

Subject: RE: [xsl] Fwd: Over/under trimming of whitespace
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Sat, 27 Apr 2002 20:17:37 +0100
> David Morris wrote:
> > I may be misinterpreting the XPATH spec, but it
> > says "The normalize-space function returns the argument string with
> > whitespace normalized by stripping leading and trailing whitespace
> > and replacing sequences of whitespace characters by a single space."
> >
> > I was expecting a single space and not an empty string
>
> I'm surprised no one noticed that before. The spec is a little
> ambiguous, isn't it?

A little informal perhaps, but I wouldn't have said it was ambiguous.

But I'm forwarding this to the public comments list as a request for the
spec to be clarified. Suggested wording:

The normalize-space function returns a string that is constructed by
applying the following changes to the argument string repeatedly until the
string is unchanged:

* if the string starts or ends with a whitespace character, that character
is removed from the string
* if the string contains two adjacent whitespace characters, that pair of
characters is replaced with a single space character (Unicode x20)

Michael Kay


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


Current Thread