Subject:Howto replace a comma with a blank Author:Archie Campbell Date:07 Dec 2006 06:33 PM
I have build a .xsl file to transform an .xml file to another .xml file.
It works nicely.
Now I want to remove any comma in a field with a null
eg
120,352 becomes 120352
I also want to remove any # character with a blank
eg
Suite#3210 becomes Suite 3210
Its seems like a simple thing to do (and probably is) but I cannot figure out how to do it.
Subject:Howto replace a comma with a blank Author:Tony Lavinio Date:08 Dec 2006 12:46 AM
For single-character replacements or removals, just use
the translate function.
Translate(expression, ',', '') will remove commas from the
expression.
Translate(expression, '#', ' ') will replace the # with a
space.
In XSLT 2.0 there is a full string search-and-replace
function. But in 1.0, for single-character replacements,
there is no need to dive deep into recursion.
Subject:Howto replace a comma with a blank Author:Archie Campbell Date:08 Dec 2006 01:36 AM
Thanks for that Toni.
I have noted function-translate and search-and-replace for next time.
Obviously much simpler.
Brian's stuff is working fine so I am going to keep it.
Plus I haven't done recursion code for a while and it was fun just doing it as yet another learning lesson with xslt.
;-)
Subject:Howto replace a comma with a blank Author:Maurice Gonsalves Date:29 May 2008 08:21 AM
Hello Tony! I saw the Translate syntax you had provided for someone. I have similar issues....I'm new in XSLT. If you can provide some direction, that would be great!
I have the the mapping below for which I need to replace all the commas for certain fields (e.g. E1KNA1M/NAME1 & E1KNA1M/NAME2).