[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
copying node but changing attributes
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.