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

copying a node

Subject: copying a node
From: lists@xxxxxxxxxxxxx
Date: Wed, 08 Mar 2006 00:44:05 +0100
copying a node
Hello List, 

I have a simple problem but I'm not sure whether xslt is the proper tool. 

I have thousands of XML files of very similar structure strictly adhering to a common document type. All documents have a node that I need to copy together with the attributes and the children and the attributes to a new node with a different value in on attribute. The reulting document must be the same plus that extra node. 

Example: 

the following file ...

<?xml version="1.0" encoding="utf-16" ?>
<filter name="ARMCheckTest">
	<group section="mini">
	</group>
	<group section="basic">
		<test name="testCheck1"></test>
		<test name="testCheck2"></test>
	</group>
</filter>
 
... needs to be transformed into

<?xml version="1.0" encoding="utf-16" ?>
<filter name="ARMCheckTest">
	<group section="mini">
	</group>
	<group section="basic">
		<test name="testCheck1"></test>
		<test name="testCheck2"></test>
	</group>

	<group section="basic-alt">
		<test name="testCheck1"></test>
		<test name="testCheck2"></test>
	</group>
</filter>

That is the node "group" with the attribute section="basic" needs to be duplicated and the value for section must be modified. 

I can think of a couple of implementations using xsl:foreach or xsl:if but I'm sure I would come up with something alittle too complicated. What's the easiest implemetation to do this?

thanks

jacques

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.