RE: [xsl] Merging and sorting multiple XML files

Subject: RE: [xsl] Merging and sorting multiple XML files
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Tue, 27 Jul 2004 17:07:12 -0500
Hey Herve,

There's already a proposed answer - didn't you check that? 

Posting three times the same message in such a short time... don't you think
you're overdoing it a bit?

Cheers,
<prs/>

-----Original Message-----
From: Herve Dubreuil [mailto:hervedub@xxxxxxxxx] 
Sent: Tuesday, July 27, 2004 4:33 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Merging and sorting 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