Re: [xsl] Replace an attribute

Subject: Re: [xsl] Replace an attribute
From: "Sean Tiley" <sean.tiley@xxxxxxxxx>
Date: Fri, 4 Jan 2008 12:13:53 -0500
Thanks Andrew,
your templates worked exactly as I wanted them to.
Now I need to spend time understanding how they work.

Are the expressions in the match="" statements XPath expressions?

Thanks again.

Sean Tiley

When you basically want to make a copy of the input XML but with
certain changes then you want to use the "indentity" transform, with
specific templates to make the change.

You're right to use the replace() function, but remember to get the
regex right.

    xmlns:xsl=""; version="2.0"

<xsl:template match="@*|node()">
        <xsl:apply-templates select="@*|node()"/>

<xsl:template match="@name">
<xsl:attribute name="name">
<xsl:value-of select="replace(., 'C:\\blah\\blah', 'files')"/>


Andrew Welch

Current Thread