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

> 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

Received on Saturday, 27 April 2002 15:16:42 UTC