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

RE: replace function

Subject: RE: replace function
From: SimonRichardson2@xxxxxxxxxx
Date: Tue, 1 Oct 2002 17:07:11 +0100
xslt replace function example
I'm a newbie to XLST and looking for good reference books.

Would you consider "Mastering XSLT, by Chuck White" as a better book than say, "XSLT 2nd Edition - Wrox Press, by Michael Kay"???

Simon


> -----Original Message-----
> From: John Pallister [mailto:jpallister@xxxxxxxxxxxx]
> Sent: 01 October 2002 15:39
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  replace function
> 
> 
> That happens to be the same as the example I had referred you 
> to earlier.
> 
> >You can use a replace template. Chuck White has an example 
> on page 594 of
> his book Mastering XSLT
> 
> Sorry if you thought I was being derogatory, I am a newbie 
> too. Next time I
> won't be so lazy and will type out the solution... 
> 
> 
> -----Original Message-----
> From: Stevenson Ngila [mailto:Stevenson@xxxxxxxxxxxxxxxxxxxxxx]
> Sent: Tuesday, October 01, 2002 3:00 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  replace function
> 
> 
> Thanks Michael Kay, i wrote one and it worked perfectly. See it below:
> 
> <xsl:template name="stringSpacing">
>   <xsl:param name="sString"/>
>   <xsl:choose>
>     <xsl:when test="contains($sString, ',')">
> 	<xsl:value-of select="substring-before($sString, ',')"/>,&#32;
> 
> 	<xsl:call-template name="stringSpacing">
> 	        <xsl:with-param name="sString"
> select="substring-after($sString,
> ',')" />
> 	 </xsl:call-template>
>     </xsl:when>
>     <xsl:otherwise>
>         <xsl:value-of select="$sString"/>
>   </xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
> 
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
> Sent: 30 September 2002 23:06
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  replace function
> 
> 
> e is get a string i.e.
> > "steve,john,peter" and replace the next word to a comma  with
> > a space hence the new string become "steve, john, peter" how
> > can i achieve this using the translate function?
> 
> Although people have written solutions to this that you can use
> off-the-shelf, it's worth learning how to write the code yourself. You
> need a recursive template, it should use substring-before() to output
> the string before the first comma, then output ", ", then use
> substring-after() and call itself to process the rest of the string
> after the first comma.
> 
> Any good XSLT textbook will have examples of this.
> 
> Michael Kay
> Software AG
> home: Michael.H.Kay@xxxxxxxxxxxx
> work: Michael.Kay@xxxxxxxxxxxxxx
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 

------------------------------------------------------------------------------
For more information on HBOS Treasury Services, please visit http://www.HBOSTS.com

Or for details of our online FX & Deposit services, please go to http://www.HBOSdeal.com

HBOS Treasury Services plc is part of the HBOS Group, which also includes Halifax plc and Bank of Scotland.
Registered Office: 33 Old Broad Street, London EC2N 1HZ. Registered No. 2692890. Registered in England.
Regulated by the Financial Services Authority.

The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error or there are any problems please notify the originator immediately. The unauthorised use, disclosure, copying or alteration of this message is strictly forbidden. This mail and any attachments have been scanned for viruses prior to leaving the HBOS Treasury Services plc network. HBOS Treasury Services plc will not be liable for direct, special, indirect or consequential damages arising from alteration of the contents of this message by a third party or as a result of any virus being passed on.

HBOS Treasury Services plc reserves the right to monitor and record e-mail messages sent to and from this address for the purposes of investigating or detecting any unauthorised use of its system and ensuring its effective operation.

==============================================================================


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.