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

Re: char replacement

Subject: Re: char replacement
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 9 May 2002 00:07:57 -0700 (PDT)
char replace
You can use the str-map() function from FXSL to replace any occurence
of a character with a given string.

See also the article "Two-stage recursive algorithms in XSLT" by
Slawomir Tyszko and Dimitre Novatchev at:

http://www.topxml.com/xsl/articles/recurse/default.asp

It describes a combination of a divide and conquer (DVC) and straight
recursion over lists as the optimal when used on large input with XSLT
processors, which do not implement tail recursion efficiently.

Cheers,
Dimitre Novatchev.
 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Philippe
> Figon
> Sent: Thursday, 9 May 2002 2:19 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  char replacement
>
>
> Hellolinefeed
>
> I am trying to write a stylesheet that could replace all the
> carriage return
> (CR) characters (Unicode 'xD') in the text() node of an element with
> something else.
> Let's put it simple ! I have an element named 'screen' with some
> text within
> and I'd wish to put something like ~\\ at the end of each line
(LaTeXing
> isn't it ?):
> <screen>
> agdh djdjdkk
> whjjd kdopd
> shdm gfjkmd
> hdjdj kkdddl
> </screen>
>
> should become :
>
>
> agdh djdjdkk~\\
> whjjd kdopd~\\
> shdm gfjkmd~\\
> hdjdj kkdddl~\\
>
> I wrote a stylesheet like this :
> (the output method is 'text')
>
> <xsl:template match="screen">
>     <xsl:variable name="texto"><xsl:value-of
> select="substring-before(.,xD)"/></xsl:variable>
>   <xsl:value-of select="concat($texto,'~\\')"/>
> </xsl:template>
>
> That works for the first 'xD' appearing but I can't find how to
> make it work
> recursively for the whole content of the 'screen' text. (XSLT is
> not the best
> thing to make strings replacements, I guess ;-) )
>
> Could anyone help ?

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

 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.