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

Subject: Re: [xsl] Fwd: Over/under trimming of whitespace
From: Mike Brown <mike@xxxxxxxxxxxxxxxx>
Date: Sat, 27 Apr 2002 00:46:56 -0600 (MDT)
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? But the intended effect is the empty string,
if the original string consists of nothing but whitespace characters.
This case should probably be clarified in XPath 2.0's functions
( http://www.w3.org/TR/xquery-operators/#func-normalize-space )

> In this case it would be nice to be able to test for some whitespace as
> opposed to an empty string.

test="string() and not(normalize-space())"

would tell you if the string's not empty and that it is empty
when its whitespace is normalized.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

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


Current Thread