RE: Search and Replace in XSLT

Subject: RE: Search and Replace in XSLT
From: Ben Robb <Ben@xxxxxxxxxx>
Date: Fri, 11 Aug 2000 11:31:35 +0100
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


Current Thread