Copying node but changing attributes

Subject: Copying node but changing attributes
From: "Joerg Colberg" <joerg.colberg@xxxxxxxxxxx>
Date: Fri, 29 Sep 100 09:50:10 EDT
Hi all,

   Here is my most recent problem: I want to copy nodes from the input
xml to the output xml but I want to change the contents of some of
their attributes. I found the following little template in Michael
Kay's book:

<xsl:template match="node">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

This template copies node plus their attributes. Now I thought
could modify the template but somehow I am stuck. I thought I
could loop over the attributes. But how do I change them. To give you
an example, some of the atributes contain placeholders. I want
to replace those with real data. How would I do this? Would the
following concept work? And how would I be able to change the 
attributes? Would the xsl:copy copy the changed attributes?

<xsl:template match="node">
  <xsl:copy>
    <xsl:for-each select="@*">
      <!-- DO SOMETHING WITH ATTR -->
      <xsl:copy/>
    </xsl:for-each>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

Thanks for any help on this!

- Joerg
________________________________
Dr Joerg M Colberg
Econovo Software, Inc
joerg.colberg@xxxxxxxxxxx



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread