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

Merging and sorting multiple XML files

Subject: Merging and sorting multiple XML files
From: Herve Dubreuil <hervedub@xxxxxxxxx>
Date: Tue, 27 Jul 2004 14:33:21 -0700 (PDT)
multiple xml files
Hi,
I've been trying all day to do this but I think I'm too much of a
newbie...

Here is the thing:
I have multiple xml files that I need to merge and then sort some data
in them.

Here is two examples of xml files:

The first one

<?xml version="1.0"?>
<PreVCD>
	<component name="stack">
		<subpath path="stack_environment">
			<variable var="ins" symbol="!" wireonbus="1"/>
		</subpath>
	</component>
	<dump>
		<time t="0">
			<data>
				<symbol sign="!" value="0"/>
			</data>
		</time>
		<time t="10">
			<data>
				<symbol sign="!" value="1"/>
			</data>
		</time>
		<time t="25">
			<data>
				<symbol sign="!" value="0"/>
			</data>
		</time>
	</dump>
</PreVCD>

and the second

<?xml version="1.0"?>
<PreVCD>
	<component name="stack">
		<subpath path="stack_behavior">
			<variable var="i" symbol="@" bussize="1"/>
		</subpath>
	</component>
	<dump>
		<time t="0">
			<data>
				<symbol sign="@" value="0"/>
			</data>
		</time>
		<time t="5">
			<data>
				<symbol sign="@" value="1"/>
			</data>
		</time>
		<time t="10">
			<data>
				<symbol sign="@" value="0"/>
			</data>
		</time>
		<time t="20">
			<data>
				<symbol sign="@" value="1"/>
			</data>
		</time>
	</dump>
</PreVCD>



The ouput should look like:

<PreVCD>
        <component name="stack">
                <subpath path="stack_behavior">
                        <variable var="i" symbol="@" bussize="1"/>
                </subpath>
                <subpath path="stack_environment">
                        <variable var="ins" symbol="!" wireonbus="1"/>
                </subpath>
        </component>
        <dump>
                <time t="0">
                        <data>
                                <symbol sign="@" value="0"/>
                                <symbol sign="!" value="0"/>
                        </data>
                </time>
                <time t="5">
                        <data>
                                <symbol sign="@" value="1"/>
                        </data>
                </time>
                <time t="10">
                        <data>
                                <symbol sign="@" value="0"/>
                                <symbol sign="!" value="1"/>
                        </data>
                </time>
                <time t="20">
                        <data>
                                <symbol sign="@" value="1"/>
                        </data>
                </time>
                <time t="25">
                        <data>
                                <symbol sign="!" value="0"/>
                        </data>
                </time>
        </dump>
</PreVCD>


This means that the node should merge in component and in time and time
must be ordered.

Thanks in advance... this would save my day !! (and night ...)

Herve
Hi,
I've been trying all day to do this but I think I'm too much of a
newbie...

Here is the thing:
I have multiple xml files that I need to merge and then sort some data
in them.

Here is two examples of xml files:

The first one

<?xml version="1.0"?>
<PreVCD>
	<component name="stack">
		<subpath path="stack_environment">
			<variable var="ins" symbol="!" wireonbus="1"/>
		</subpath>
	</component>
	<dump>
		<time t="0">
			<data>
				<symbol sign="!" value="0"/>
			</data>
		</time>
		<time t="10">
			<data>
				<symbol sign="!" value="1"/>
			</data>
		</time>
		<time t="25">
			<data>
				<symbol sign="!" value="0"/>
			</data>
		</time>
	</dump>
</PreVCD>

and the second

<?xml version="1.0"?>
<PreVCD>
	<component name="stack">
		<subpath path="stack_behavior">
			<variable var="i" symbol="@" bussize="1"/>
		</subpath>
	</component>
	<dump>
		<time t="0">
			<data>
				<symbol sign="@" value="0"/>
			</data>
		</time>
		<time t="5">
			<data>
				<symbol sign="@" value="1"/>
			</data>
		</time>
		<time t="10">
			<data>
				<symbol sign="@" value="0"/>
			</data>
		</time>
		<time t="20">
			<data>
				<symbol sign="@" value="1"/>
			</data>
		</time>
	</dump>
</PreVCD>



The ouput should look like:

<PreVCD>
        <component name="stack">
                <subpath path="stack_behavior">
                        <variable var="i" symbol="@" bussize="1"/>
                </subpath>
                <subpath path="stack_environment">
                        <variable var="ins" symbol="!" wireonbus="1"/>
                </subpath>
        </component>
        <dump>
                <time t="0">
                        <data>
                                <symbol sign="@" value="0"/>
                                <symbol sign="!" value="0"/>
                        </data>
                </time>
                <time t="5">
                        <data>
                                <symbol sign="@" value="1"/>
                        </data>
                </time>
                <time t="10">
                        <data>
                                <symbol sign="@" value="0"/>
                                <symbol sign="!" value="1"/>
                        </data>
                </time>
                <time t="20">
                        <data>
                                <symbol sign="@" value="1"/>
                        </data>
                </time>
                <time t="25">
                        <data>
                                <symbol sign="!" value="0"/>
                        </data>
                </time>
        </dump>
</PreVCD>


This means that the node should merge in component and in time and time
must be ordered.

Thanks in advance... this would save my day !! (and night ...)

Herve

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.