[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Detecting and replacing "Space" in a XML using XSL
Subject: Re: Detecting and replacing "Space" in a XML using XSL
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 11 Sep 2007 11:50:23 -0400
|
Buddhi,
No (you are correct), translate() won't work for this purpose.
If using XSLT 2.0, you want the replace() function.
If using XSLT 1.0, this is considerably more difficult, but not
impossible. Consult the FAQ at http://www.dpawson.co.uk/xsl/sect2/replace.html.
Cheers,
Wendell
At 11:51 PM 9/10/2007, you wrote:
Hi all,
I have a string element in a xml file, it can consist a word. After
parsing I am taking letter by letter with some formatting stuff.
Ex.
My original String:
<Value>H A N</Value>
After Parsing : (I have trimmed output for more clearance)
<Body>
<FontFace value="STDFONT.FNT"><FontSize
value="0.2">H</FontSize></FontFace>
<FontFace value="STDFONT.FNT"><FontSize
value="0.2"></FontSize></FontFace>
<FontFace value="STDFONT.FNT"><FontSize
value="0.2">A</FontSize></FontFace>
<FontFace value="STDFONT.FNT"><FontSize
value="0.2"></FontSize></FontFace>
<FontFace value="STDFONT.FNT"><FontSize
value="0.2">N</FontSize></FontFace>
</Body>
As you see I have spaces on my original string.
I want to translate spaces into '_x0020_' rather than empty space. I
tried using "translate()" but it will put one character because I have
single space.
translate(substring($text,$i,1), ' ', '_x0020_')
The out put I want to get is...
....
<FontFace value="STDFONT.FNT"><FontSize
value="0.2">_x0020_</FontSize></FontFace>
....
Please help me....
- Regards
- Buddhi from Sri Lanka -
======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
|
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
RSS 2.0 |
|
Atom 0.3 |
|
|