[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: removing trailing space for all the elements
Hi,
Something like below will do it: <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <xsl:template match="text()" priority="1"> <xsl:variable name="normalized" select="normalize-space(.)"/> <xsl:variable name="firstToken" select="substring-before($normalized, ' ')"/> <xsl:value-of select="if ($normalized='' or $firstToken!='') then concat ($firstToken, substring-after(., $firstToken)) else concat ($normalized, substring-after(., $normalized)) "/> </xsl:template> Depending on your actual needs you may find that the simpler solution below also works for you: <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <xsl:template match="text()" priority="1"> <xsl:value-of select="normalize-space(.)"/> </xsl:template> Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com M Balaji wrote: Hi All,
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|