|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








