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

Re: Replacing all Occurences of a String

Subject: Re: Replacing all Occurences of a String
From: "cutlass" <cutlass@xxxxxxxxxxx>
Date: Thu, 30 Aug 2001 14:37:20 +0100
edt replace
huh ?

try out this template here;

http://www.exslt.org/str/functions/replace/index.html

though u will be passing params, but of course u could recurse calling this
named template etc...

u could also use many of the date/time templates here, or at other places
that make facilities for delivering in different languages.

good luck, jim fuller

----- Original Message -----
From: "Roger" <roger@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, August 30, 2001 2:31 PM
Subject:  Replacing all Occurences of a String


> Hi there
> I want to replace the english months with the german months. It is
possible
> that the elements <sfzRelease/> and <sfzProdjahr/> have several months,
like
> this:
>
> <sfzRelease>January, February 2001</sfzRelease>
>
> I want at the end:
>
> <sfzRelease>Januar, Februar 2001</sfzRelease>
>
> I took Michael Kay's replace.xsl Stylesheet (Replacing all Occurences of a
> String). But I don't want to give it the parameters in the stylesheet
> itself. I made a xsl:choose with the parameters, but that isn't accepted.
> Can anyone help me with this.
> Thanx very much
> Roger
>
>
>
>
>
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet
> version="1.O"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>
> <xsl:param name="replace"/>
> <xsl:param name="by"/>
>
> <xsl:choose>
> <xsl:when test="$replace='January'">
> <xsl:param name="by" select="Januar"/>
> </xsl:when>
>    <xsl:when test="$replace='February'">
> <xsl:param name="by" select="Februar"/>
> </xsl:when>
> <xsl:when test="$replace='March'">
> <xsl:param name="by" select="März"/>
> </xsl:when>
> <xsl:when test="$replace='May'">
> <xsl:param name="by" select="Mai"/>
> </xsl:when>
> <xsl:when test="$replace='June'">
> <xsl:param name="by" select="Juni"/>
> </xsl:when>
> <xsl:when test="$replace='July'">
> <xsl:param name="by" select="Juli"/>
> </xsl:when>
> <xsl:when test="$replace='October'">
> <xsl:param name="by" select="Oktober"/>
> </xsl:when>
> <xsl:when test="$replace='December'">
> <xsl:param name="by" select="Dezember"/>
> </xsl:when>
> </xsl:choose>
>
>
> <xsl:template name="do-replace">
> <xsl:param name="text"/>
> <xsl:choose>
> <xsl:when test="contains($text,$replace)">
> <xsl:value-of select="substring-before($text, $replace)"/>
> <xsl:value-of select="$by"/>
> <xsl:call-template name="do-replace">
> <xsl:with-param name="text"
> select="substring-after($text, $replace)"/>
> </xsl:call-template>
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="$text"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
> <xsl:template match="sfzRelease | sfzProdjahr">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsl:apply-templates/>
> </xsl:copy>
> </xsl:template>
>
> <xsl:template match="text()">
> <xsl:call-template name="do-replace">
> <xsl:with-param name="text" select="."/>
> </xsl:call-template>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 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.