This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
copy nodes as keys
- From: Thomas Olausson <thomas dot olausson at home dot se>
- To: XSL-List at lists dot mulberrytech dot com
- Date: Wed, 18 Sep 2002 04:01:13 +0200
- Subject: [xsl] copy nodes as keys
- Reply-to: xsl-list at lists dot mulberrytech dot com
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