Re: [xml-dev] preserving prefix names while replacing

From
<>
To
Date
2005-08-25T00:26:02Z
ID
<>
Thread
Re: [xml-dev] preserving prefix names while replacing
In article <> you write:

>Currently I have:
>
><xsl:template match="soapenv:Body">
>  <soapenv:Body Id="MsgBody">
>...
>
>The problem with this is that it doesn't preserve the original
>document's prefix name, which is what I want to do as this is part of an
>override xsl for an identity transform.

Instead of using a literal result element, copy the original:

 <xsl:template match="soapenv:Body">
   <xsl:copy>
     <xsl:attribute name="id">MsgBody</xsl:attribute>
     ...
   </xsl:copy>
   ...

This isn't guaranteed to preserve the prefix, but will in many XSLT
implementations.

-- Richard