[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: String manipulation XSLT 1.0

Subject: Re: String manipulation XSLT 1.0
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 22 Sep 2010 14:50:02 +0200
Re:  String manipulation XSLT 1.0
pankaj.c@xxxxxxxxxxxxxxxxxx wrote:

Input
====
<given-name>A.H.</given-name>

Output
====
<given-name>A. H.</given-name> <!--  Notice the space after A.  -->

I tried using translate function

<xsl:template match="given-name">
<xsl:copy>
<xsl:value-of select="translate(.,'.','. ')"/> </xsl:copy> </xsl:template>


But noticed that translate ignores space given to second argument after dot (single character to single character). So the result is same as it is.

translate translates character by character. Maybe
<xsl:value-of select="concat(substring-before(., '.'), '. ', substring-after(., '.'))"/>
does what you want but it depends on what kind of contents that given-name element can contain.
Or check http://exslt.org/ for a replace template for XSLT 1.0.




--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.