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

Re: Replacing strings

Subject: Re: Replacing strings
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 24 Nov 2005 21:03:22 +1100
replacing strings
Use:

concat(substring(.,1,string-length(substring-before(translate(.,$up,$l),$plcP
at))
	           ),

             $pReplacement,

             substring(.,string-length(substring-before(translate(.,$up,$l),$
plcPat))
	           +string-length($plcPat)+1
	          )
             )


where $u and $l are defined to contain the upper-case and lower-case
latin letters in the same order.



--
Cheers,
Dimitre Novatchev
---------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all.



On 11/24/05, Sven Waibel <sven.waibel@xxxxxxxx> wrote:
> Hello,
>
> i have a string that contains the value of CDATA field.
>
> The string may contain following string:
> "Vorbedinung"
> "vorbedingung"
> "VORBEDINGUNG"
> and many, many other strings.
>
> The strings should be replaced by "PRECONDITION".
>
> I'm using following code up to now, but so i can replace just one string.
>
> Does anybody know how to replace these strings?
>
> Thanks
> Sven
>
> <xsl:template name="replace_precond">
>        <xsl:param name="string" />
>        <xsl:param name="from" select="'Vorbedingung'" />
>        <xsl:param name="to" select="'PRECONDITION'" />
>        <xsl:choose>
>                <xsl:when test="contains($string, $from)">
>                        <xsl:value-of select="substring-before($string,
$from)" />
>                        <xsl:copy-of select="$to" />
>                        <xsl:call-template name="replace_precond">
>                                <xsl:with-param name="string"
select="substring-after($string,
> $from)" />
>                                <xsl:with-param name="from" select="$from"
/>
>                                <xsl:with-param name="to" select="$to" />
>                        </xsl:call-template>
>                </xsl:when>
>                <xsl:otherwise>
>                        <xsl:value-of select="$string" />
>                </xsl:otherwise>
>        </xsl:choose>
> </xsl:template>

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.