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

Subject: [xsl] Copying into additional attributes from a different part of the tree
From: "john smith" <john_smith73@xxxxxxxxxxx>
Date: Tue, 31 Jul 2001 16:01:35 +0000

Given:


<A>
 <B>
   <C id="1" name="CC">
     <D id="2" name="DD"/>
   </C>
 </B>
 <E>
   <F>
     <class>foo</class>
     <NAME>C</NAME>
   </F>
   <F>
     <method>test</method>
     <NAME>C</NAME>
   </F>
   <F>
     <class>foo1</class>
     <NAME>D</NAME>
   </F>
   <F>
     <method>test1</method>
     <NAME>D</NAME>
   </F>
 </E>
</A>


into:


<AA>
   <C id="1" name="CC" class="foo" method="test">
     <D id="2" name="DD" class="foo1" method="test1" />
   </C>
</AA>

The transformation process is as follows:

1. Copy all nodes and attributes of B's descendants
  {in this case, C and D}
  --> At this stage, this is what my result tree will look like:
<AA>
   <C id="1" name="CC">
     <D id="2" name="DD"/>
   </C>
</AA>

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?

Thanks a lot for the help...


_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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



Current Thread