One way would be to create a default template which simply copies
everything across, and then override it in the case of elements called
ABC:jason.Smith.

Eg, here's the copy-everything bit:

---- copy-all.xsl ----

<?xml version="1.0"?>
<!--
This template copies all nodes it encounters, but at each node allows other
templates to match (unlike a copy-of from the root). 
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:template match="child::node()|attribute::*">
                <xsl:copy>
                        <xsl:for-each select="@*">
                                <xsl:copy/>
                        </xsl:for-each>
                        <xsl:apply-templates/>
                </xsl:copy>
        </xsl:template>
</xsl:stylesheet>


and here's a stylesheet that uses this, and renames one element:


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:ABC="org.jason">
        <xsl:import href="copy-all.xsl"/>

        <xsl:template match="ABC:jason.Smith">
                <ABC:Smith>
                        <xsl:apply-templates/>
                </ABC:Smith>
        </xsl:template>
</xsl:stylesheet>


That's adapted from Mike Kay's XSLT book (1st ed) in the <xsl:copy-of>
section.

HTH,

--Jeff


On Sat, Jan 12, 2002 at 02:47:00PM -0800, Jason Rizer wrote:
...
> In other words I want to replace each elament named
> jason.Smith with an identical element (ie not affect any of it's
> children or it's attributes) named Smith but only when It occurs in
> the Namespace ABC. 
...
> Any help with creating this stylesheet would be greatly appreciated.
> Thank in
> advance!
> 
> -Jaso
> 
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/

Reply via email to