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

copy nodes as keys

Subject: copy nodes as keys
From: Thomas Olausson <thomas.olausson@xxxxxxx>
Date: Wed, 18 Sep 2002 04:01:13 +0200
as keys
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

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.