|
Subject: Re: [xsl] Lookup table and maintaining hierarchy From: "Mir Farooq Ali" <miali@xxxxxxxxx> Date: Mon, 7 Jun 2004 13:03:21 -0400 (EDT) |
> Hi Farooq,
> You have'nt explained enough, what logic you are
> using for transformation. It will help us in solving
> the problem. Looking only at the input XML, and the
> desired output, its tough to guess the logic of
> transformation..
>
> Regards,
> Mukul
>
>
Hi Mukul,
Sorry for the lack of explanation about the transformations in my earlier
emails. Let me elaborate on what I'm trying to do.
In the input file shown below, each element T has the elements UC and UPS
within Prefs. The lookup is supposed to be done based on those from the
lookup file. More explanation below the input file.
<?xml version="1.0" encoding="utf-8" ?>
<TM>
<T id="something" TC="a">
<Type>b</Type>
<Prefs>
<UC>S</UC>
<UPS>1</UPS>
</Prefs>
<ST>
<T id="somethinga" TC="a">
<Type>b</Type>
<Prefs>
<UC>S</UC>
<UPS>1</UPS>
</Prefs>
<ST>
<T id="somethingb" TC="a">
<Type>b</Type>
<Prefs>
<UC>S</UC>
<UPS>1</UPS>
</Prefs>
</T>
<T id="somethingc" TC="a">
<Type>b</Type>
<Prefs>
<UC>S</UC>
<UPS>2</UPS>
</Prefs>
</T>
</ST>
</T>
<T id="somethingd" TC="a">
<Type>b</Type>
<Prefs>
<UC>S</UC>
<UPS>2</UPS>
</Prefs>
</T>
</ST>
</T>
<T id="somethinge" TC="a">
<Type>b</Type>
<Prefs>
<UC>S</UC>
<UPS>2</UPS>
</Prefs>
</T>
</TM>
So for the element T with id "something", attribute TC = a, UC = S and UPS
= 1, which looks like this
<T id="something" TC="a">
<Type>b</Type>
<Prefs>
<UC>S</UC>
<UPS>1</UPS>
</Prefs>
...
a lookup is performed in the lookup file
<AB>
<TC name="a">
<TTM type="b">
<UCM preference="1">
<UC>S</UC>
<UPS>
<pa prefnum="1">
<XXXX>
<YYYY />
<ZZZZ />
</XXXX>
</pa>
<pa prefnum="2">
<WWWW />
</pa>
</UPS>
</UCM>
</TTM>
</TC>
</AB>
and this chunk
<XXXX>
<YYYY />
<ZZZZ />
</XXXX>
is extracted and inserted in the target xml as
<p id="something1" c="XXXX">
<p id="something11" c="YYYY" />
<p id="something12" c="ZZZZ" />
....
</p>
This needs to be done for each T element in the file and the output for
the complete XML should look something like this
<?xml version="1.0" encoding="utf-8" ?>
<S>
<p id="something1" c="XXXX">
<p id="something11" c="YYYY" />
<p id="something12" c="ZZZZ" />
<p id="somethinga1" c="XXXX">
<p id="somethinga11" c="YYYY" />
<p id="somethinga12" c="ZZZZ" />
<p id="somethingb1" c="XXXX">
<p id="somethingb11" c="YYYY" />
<p id="somethingb12" c="ZZZZ" />
</p>
<p id="somethingc1" c="WWWW" />
</p>
<p id="somethingd1" c="WWWW" />
</p>
<p id="somethinge1" c="WWWW" />
</S>
Thanks for any help you can provide me.
-Farooq.
--
Mir Farooq Ali
Computer Science, Virginia Tech,
Email: miali@xxxxxxxxx
Web: http://purl.org/net/farooq
Office: 525 McBryde Hall
Tel: (540) 231-1927
--------------------------------------------
(c) 2004 Mir Farooq Ali All rights reserved
--------------------------------------------
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Lookup table and maintain, Mukul Gandhi | Thread | RE: [xsl] Duplicate elements. HELP!, Stoaks, Max |
| RE: RE: RE: [xsl] Unexpected result, Christopher Jacob | Date | RE: RE: [xsl] Unexpected results wh, Josh Canfield |
| Month |