[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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.
At 11:51 PM 9/10/2007, you wrote:
Re: [xsl] Detecting and replacing "Space" in a XML using XSL
Subject: Re: [xsl] 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Detecting and replacing ", oryann9 | Thread | [xsl] Keeping track of processed no, John Smith |
Re: [xsl] Transforming flat ?WordML, Wendell Piez | Date | [xsl] Escaped markup 2 temporary tr, Jesper Tverskov |
Month |