Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2009, 10:47 PM
Registered User
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default remove spaces between strings

Hi frnds
This forum is very useful for me, as I got solutions to most of questions.
Now I need one more help. I have a string in xml for example "this is my string". My xsl should remove whitespaces in between them . the output should be like "thisismystring"
Thanks
Javaguy
 
Old April 8th, 2009, 12:52 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Thumbs up

For your input <Section>This is my string</Section>, use the below template.

<xsl:template match="Section">
<xsl:value-of select="replace(., ' ', '')"></xsl:value-of>
</xsl:template>
__________________
Rummy
 
Old April 8th, 2009, 03:03 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you're using version 1.0 then use the translate function instead:
Code:
translate(" ", "")
So all spaces are translated to an empty string.
__________________
Joe
http://joe.fawcett.name/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Spaces XP Programmer911 General .NET 1 December 19th, 2007 07:03 AM
Diference between these two name spaces pradeepn XSLT 1 June 25th, 2007 02:31 AM
disappearing spaces gezi XSLT 0 March 26th, 2006 02:23 AM
Removing spaces Dave Brown Beginning PHP 2 October 28th, 2005 12:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.