| Subject: [xsl] copy nodes as keys From: Thomas Olausson <thomas.olausson@xxxxxxx> Date: Wed, 18 Sep 2002 04:01:13 +0200 | 
Can I use xsl:key for this?
I want to copy nodes based on a id-attribute from one location in the document to another,
I've tried a couple of XSLTs, but it seems like a trick!
I want to copy the workshop-children into their respective chair ids:
input:
<myxml>
  <showroom>
    <chair id="1">
      <feature1>nice</feature1>
      <feature2>yes, nice</feature2>
    </chair>
    <chair id="3">
      <feature1>cheap</feature1>
      <feature2>flat</feature2>
    </chair>
  </showroom>
  <workshop>
    <extrachairstuff id="1">
       <salesfeature1>financing</salesfeature1>
       <salesfeature2>no payments</salesfeature2>
    </extrachairstuff>
    <extrachairstuff id="3">
       <salesfeature1>not much really</salesfeature1>
    </extrachairstuff>
  </workshop>
</myxml>
desired output:
<myxml>
  <showroom>
    <chair id="1">
      <feature1>nice</feature1>
      <feature2>nice</feature2>
      <extrachairstuff id="1">
        <salesfeature1>financing</salesfeature1>
        <salesfeature2>no payments</salesfeature2>
      </extrachairstuff>
    </chair>
    <chair id="3">
      <feature1>cheap</feature1>
      <feature2>flat</feature2>
      <extrachairstuff id="3">
        <salesfeature1>not much really</salesfeature1>
      </extrachairstuff>
    </chair>
  </showroom>
  <workshop>
    <extrachairstuff id="1">
      <salesfeature1>financing</salesfeature1>
      <salesfeature2>no payments</salesfeature2>
    </extrachairstuff>
    <extrachairstuff id="3">
      <salesfeature1>not much really</salesfeature1>
    </extrachairstuff>
  </workshop>
</myxml>
Regards,
/Thomas
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] number in xsl:for-each (n, Joerg Heinicke | Thread | RE: [xsl] copy nodes as keys, Jarno . Elovirta | 
| RE: [xsl] sorting on data reference, Carter, Will | Date | [xsl] Recursive problem, Satish, L. Gnanendra | 
| Month |