xsl-list
[Top] [All Lists]

RE: replacement example , help

2005-03-29 09:51:07
Henry, search this list for references to "XSLT Cookbook"; that book, and its freely downloadable code, contains many recipes for string matching, replacement, etc.

Regards,

--A


From: henry human <henry_human(_at_)yahoo(_dot_)de>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl]  replacement example , help
Date: Tue, 29 Mar 2005 13:01:06 +0200 (CEST)

hello,
In this xsl styesheet i will replace aa with the
string cc,
what do i wrong ,that
i dont get cc?
thank you to have a look on this stylesheet:


<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="replace.xsl"?>


<document>
<part1>
<name>uaabb</name>
</part1>
</document>

------------



<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html"/>

<xsl:template name="part1">
<xsl:param name="name"/>
<xsl:param name="aa"/>
<xsl:param name="cc"/>
<xsl:choose>
<xsl:when test="contains($name,$aa)">
<xsl:value-of select="substring-before($name,$aa)"/>
<xsl:value-of select="$cc"/>

<xsl:call-template name="part1">
<xsl:with-param name="name"
select="substring-after($name,$aa)"/>
<xsl:with-param name="aa" select="$aa"/>
<xsl:with-param name="cc" select="$cc"/>
</xsl:call-template>

</xsl:when>

<xsl:otherwise>
<xsl:value-of select="$name"/>
</xsl:otherwise>

</xsl:choose>

</xsl:template>

</xsl:stylesheet>


_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar ? get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--