Subject: AW: Replacing all Occurences of a String
From: "Roger" <roger@xxxxxxxx>
Date: Thu, 30 Aug 2001 16:26:36 +0200
|
hi jim
isn't there maybe a simpler way? and can I use the exslt functions with
sablotron 0.60?
best
roger
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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Grouping headers revisted, (continued)
- Haque, Suraiya - Thu, 30 Aug 2001 08:20:04 -0400 (EDT)
- Roger - Thu, 30 Aug 2001 09:42:25 -0400 (EDT)
- cutlass - Thu, 30 Aug 2001 09:49:35 -0400 (EDT)
- Roger - Thu, 30 Aug 2001 10:36:43 -0400 (EDT) <=
- cutlass - Thu, 30 Aug 2001 11:04:44 -0400 (EDT)
- Ilya Khandamirov - Thu, 30 Aug 2001 11:38:19 -0400 (EDT)
- David Carlisle - Thu, 30 Aug 2001 12:08:58 -0400 (EDT)
- Thomas B. Passin - Thu, 30 Aug 2001 12:47:17 -0400 (EDT)
|
|