[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hello,
Background to problem:
My inital query was about character transformations and this was resolved via David Pawsons web site (thanks to David Carisle & Michael Kay). However I want to perform 3 character transformation meaning I need to call this transformation template 3 times, my stylesheet is formed as a single template. I'm barking up the nested template tree a bit. I have followed the previous mails but I am nevertheless confused.
A brief description of my problem:
Therfore I am extracting text from an xml file and I want to replace 3 character in this text, any suggestions about the positioning and if its a <xsl:call-template>, <xsl:apply-template> with modes etc. I shall be very grateful as I'm confused!
template code to perform character transformation within a string:
<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="with"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text, $replace)" />
<xsl:value-of select="$with" />
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="substring-after($text,$replace)" />
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="with" select="$with"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Sample xslt of want I'm trying to achieve:
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
[xsl] templates, not nested
Subject: [xsl] templates, not nested From: "Julie Mc Cabe" <julesofenergy@xxxxxxxxxxx> Date: Thu, 17 May 2001 10:59:32 -0000 |
Hello,
Background to problem:
My inital query was about character transformations and this was resolved via David Pawsons web site (thanks to David Carisle & Michael Kay). However I want to perform 3 character transformation meaning I need to call this transformation template 3 times, my stylesheet is formed as a single template. I'm barking up the nested template tree a bit. I have followed the previous mails but I am nevertheless confused.
A brief description of my problem:
Therfore I am extracting text from an xml file and I want to replace 3 character in this text, any suggestions about the positioning and if its a <xsl:call-template>, <xsl:apply-template> with modes etc. I shall be very grateful as I'm confused!
template code to perform character transformation within a string:
<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="with"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text, $replace)" />
<xsl:value-of select="$with" />
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="substring-after($text,$replace)" />
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="with" select="$with"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Sample xslt of want I'm trying to achieve:
<xsl:template match="/"> <xsl:varabile name="title" select"...." /> want to call template replace-string here with param text=$title
Many Thanks, Julie Mc Cabe. _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Antwort: [xsl] [xsl] £ character r, P . Vogt | Thread | [xsl] Variables, Mengel Andre (FV/SLM |
Re: [xsl] Conditional Assigining, Sri ni | Date | [xsl] Variables, Mengel Andre (FV/SLM |
Month |