« November 1, 2007 | Main | November 22, 2007 »

November 14, 2007 Archives

November 14, 2007

Removing additional whitespaces in your Elements and Attributes

In case your XML elements contain multiple whitespaces within the text, or leading and trailing the text, you could use normalize-space() function to remove the leading and trailing whitespaces, as well as to combine all adjacent intermediary whitespaces into one single whitespace.


For e.g


Input


<input>   1sp 2sp  3sp   4sp     5sp     3sp   end</input>


XSLT


 <ns1:result>
   <xsl:value-of select="normalize-space(/input)"/>
</ns1:result>


Result


<result>1sp 2sp 3sp 4sp 5sp 3sp end</result>

About November 2007

This page contains all entries posted to Ramkumar Menon's Blog in November 2007. They are listed from oldest to newest.

November 1, 2007 is the previous archive.

November 22, 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle