[xsl] Not-quite normalize-space()

Subject: [xsl] Not-quite normalize-space()
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Mar 2007 15:24:11 +1200

In various contexts I want to process text() nodes differently:

a) strip off leading WS, retain trailing WS, and normalize the rest
b) retain leading WS, strip off trailing WS, normalize the rest
c) retain leading and trailing WS, normalize the rest

I can write (have written) long-winded and rather unsatisfying procedures to
do all of these. But I had hoped that there might be something
concise/smart/elegant in the FAQ, however I haven't seen anything I
recognized as doing the above.

I'm sure that my (a) (b) and (c) must be reasonably common, so can anyone
offer a nice implementation? My application is still XSLT 1.0, but I'd be
interested to learn of any neater 2.0 solution too.


Current Thread