Re: [xsl] Copying into additional attributes from a different part of the tree

Subject: Re: [xsl] Copying into additional attributes from a different part of the tree
From: David_Marston@xxxxxxxxx
Date: Tue, 31 Jul 2001 15:57:35 -0400
The Invisible Stylesheeter writes:
>The transformation process is as follows:
>1. Copy all nodes and attributes of B's descendants
>   {in this case, C and D}
>...
>2. Look for the NAME attribute in children of E/F and copy the
>corresponding values of class and method names into attributes and add
>it to the above tree: The result will be:
> <AA>
>   <C id="1" name="CC" class="foo" method="test">
>     <D id="2" name="DD" class="foo1" method="test1" />
>   </C>
>  </AA>
>I used the <xsl:copy-of> to do step 1...How can I do step 2?

Since step 2 turns this into the expand-structure-as-I-copy-it
scenario, you have to go back and re-do step 1 with xsl:copy, then
jump in with xsl:attribute at the appropriate places to add in the
extra attributes. I believe that the FAQ has some examples of
copying everything while adding extra stuff. Attributes are subject
to rules about when they can be added: after (so to speak) namespace
nodes but before text, comments, PIs, and child elements.
.................David Marston


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


Current Thread