Hi,
If you would like to do the replacement on multiple tags, you have
many options.
1. you can do like suggested earlier.
<xsl:template match="name|surname|aaa|bbb">
or
2. Have individual templates for name, surname, aaa and bbb
or
3. or you can use a for-each to iterate over part1 node's child nodes
or
4. do an <xsl:apply-templates select="*"/> inside your template for part1
and do as in 1 or 2 above.
And you don't have to do substring-before/substring-after, you can use the
translate function:
<xsl:value-of select="translate($name, '.', ':')"/>
Also, You don't have a node named ptr1 in your xml.
Cheers,
Omprakash.V
henry human
<henry_human@ To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
yahoo.de> cc: (bcc: omprakash.v/Polaris)
Subject: [xsl] replacement more
than one Tag in node
03/30/2005
03:30 AM
Please
respond to
xsl-list
hello,
this time i will to define a template to
replace . with : in more than one Tags
f.e replace in name, surname,aaa,bbb ...
how should the template rule be defined to do this??
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="my.xsl"?>
<document>
<part1>
<ttt>u.bb</ttt>
<name>u.bb</name>
<surname>u.bb</surname>
<aaa>u.bb</aaa>
<bbb>u.bb</bbb>
</part1>
<part2>
<name>u.bb</name>
</part2>
</document>
-----
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="document">
<xsl:apply-templates select="part1"/>
</xsl:template>
<xsl:template match="ptr1">
<xsl:call-template name="part1">
<xsl:with-param name="name" select="name"/>
<xsl:with-param name="search_for" select="'.'"/>
<xsl:with-param name="replace_out" select="':'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="part1">
<xsl:param name="name"/>
<xsl:param name="search_for"/>
<xsl:param name="replace_out"/>
<xsl:choose>
<xsl:when test="contains($name,$search_for)">
<xsl:value-of
select="substring-before($name,$search_for)"/>
<xsl:value-of select="$replace_out"/>
<xsl:call-template name="part1">
<xsl:with-param name="name"
select="substring-after($name,$search_for)"/>
<xsl:with-param name="search_for"
select="$search_for"/>
<xsl:with-param name="replace_out"
select="$replace_out"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$name"/>
</xsl:otherwise></xsl:choose></xsl:template>
</xsl:stylesheet>
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier
anmelden: http://mail.yahoo.de
--~------------------------------------------------------------------
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>
--~--
This e-Mail may contain proprietary and confidential information and is sent
for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction,
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its
attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
--~------------------------------------------------------------------
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>
--~--