This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Search and Replace in XSLT
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Search and Replace in XSLT
- From: Ben Robb <Ben at cscape dot com>
- Date: Fri, 11 Aug 2000 11:31:35 +0100
- Reply-To: xsl-list at mulberrytech dot com
I'm not sure that you want a search and replace function (though the
translate() function would do this).
From the input:
<img src="x.bmp" alt="[tag]"/>
you want the output:
<img src="x.bmp"><tag/></img>
This could be done in the following way:
<xsl:template match="img">
<img src="{@src}">
<xsl:element name="{translate(@alt,'[]', '')}" />
</img>
</xsl:template>
(though it would eliminate the need for the translate function if the [ and
the ] were not in the source)
Hope this helps,
Ben
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list