Subject: [xsl] xslt 1.1 - one liner From: "Hasnain Panjwani" <niansah@xxxxxxxxx> Date: Thu, 5 Jul 2007 11:06:37 +0200 |
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,' ','~')),'~',' ')" />
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.
-- H. Panjwani The Netherlands
-- H. Panjwani The Netherlands
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Hidden implementation-def, Michael Kay | Thread | Re: [xsl] xslt 1.1 - one liner, David Carlisle |
Re: [xsl] Hidden implementation-def, David Carlisle | Date | RE: [xsl] Hidden implementation-def, Michael Kay |
Month |