[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] strip leading whitespace for sorting


Subject: Re: [xsl] strip leading whitespace for sorting
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 27 Oct 2008 06:05:55 -0700

> To answer my own question: I misunderstood. The tool I needed was
> normalize-space(), i.e.:

It is possible that was a second misunderstanding:  normalize-space()
does a little more than just removing the leading spaces.

It also removes all trailing spaces. It also substitutes any group of
spaces left with a single space.

If you really wanted to only remove leading spaces, you nedded
something as (the first half of) the transformation that performs
trim(). This uses FXSL and was published almost 7 years ago:

   http://markmail.org/message/3d2nkzc7ubye4fcg

Removing the leading spaces is one of the more simple tasks performed
by that transformation and only the "trim1" template is necessary.

Even with the ability to use regular expressions in XSLT 2.0, the
"trim" transformation still has in itself the value of a mildly
stretching thinking exercise and of a suitable way of discussing some
basic functional programming techniques.

-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play


Current Thread
Keywords