[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xslt 1.1 - one liner

Subject: xslt 1.1 - one liner
From: "Hasnain Panjwani" <niansah@xxxxxxxxx>
Date: Thu, 5 Jul 2007 11:06:37 +0200
 xslt 1.1 - one liner
Hi all,

Here is a very old most asked / answered question: XSLT 1.1: Trimming
leading and trailing spaces. I have looked at multiple solutions,
recursive templates because I need to use it in my code. They all seem
very long and verbose, so I want to know is there is any hit on
processing/speed if I simply use this:

<xsl:value-of select="translate(normalize-space(translate($text,'
&#10;','~')),'~',' &#10;')" />

Basically:
First replace all linefeed characters  - because normalize-space would
remove line-feed cahracter  with some character that you know will
not be used in the text  I used "~"  by using the translate
function. Then use normalize-space, replacing all white space, then
translate the "~" back to line-feed.

This is a one liner solution and it works for me  I just want to know
if this would be slower than a recursive template solution.

Advise would be well appreciated.

Thanks,

Hasnain Panjwani


-- H. Panjwani The Netherlands

--
H. Panjwani
The Netherlands

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.