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

Follow-up question [Fwd: Question about variable-field

Subject: Follow-up question [Fwd: Question about variable-field lookuptables]
From: Mir Farooq Ali <miali@xxxxxxxxx>
Date: Tue, 20 Jan 2004 12:49:36 -0500
follow up question

Hi,


I have another problem as a follow-up to the one mentioned below. How do I transmit the value of the id attribute in the XML file down to the newly created elements? In the fragment below, the id is "something", so the XML that is generated should look something like this

      <p id="something1" c="XXXX">
         <p id="something11" c="YYYY"/>
         <p id="something12" c="ZZZZ"/>
      </p>

for the first case

and

<p id="something1" c="WWWW"/>

for the second case.

A broader question that I have is how to relate (or tie) the nodes in the main XML file when the context has switched to the lookup file.

Regards,

-Farooq.

--
Mir Farooq Ali

Computer Science, Virginia Tech,
Email: miali@xxxxxxxxx
Web: http://purl.org/net/farooq
--------------------------------------------
(c) 2004 Mir Farooq Ali  All rights reserved
--------------------------------------------

-------- Original Message --------
Subject:  Question about variable-field lookup tables
Date: Mon, 12 Jan 2004 11:41:59 -0500 (EST)
From: Mir Farooq Ali <miali@xxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx


Hi,


I need some help with a particular problem I'm trying to solve. I need to
transform an xml document that is based partially on information that is
extracted from another xml file whose purpose is to act like a lookup
table. However, the wrinkle is that the values extracted from the lookup
table are xml fragments that might be one or more fields.

An sample of the xml lookup file looks like this

<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>

The xml file that needs to be tranformed looks something like this

<TM>
    <T id="something" TC="a">
        <Type>b</Type>
        <Prefs>
            <UC>S</UC>
            <UPS>1</UPS>
        </Prefs>
    </T>
    ...
</TM>

Based on the lookup from the first file, since the UPS value is 1, the
corresonding XML fragment from above
        <XXXX>
          <YYYY/>
          <ZZZZ/>
        </XXXX>
needs to be *modified* and copied into the output tree. The above code
will have to look something like this

      <p c="XXXX">
         <p c="YYYY"/>
         <p c="ZZZZ"/>
      </p>

If on the other hand, the UPS value was 2, then the lookup matches the
second XML fragment and the code will be

<p c="WWWW"/>

The problem I'm having is to figure out how to do the *copy and
tranformation* of the xml fragment since I don't know deeply nested it
might be. I'm stumped in thinking of an elegant solution to this problem.

Any help is appreciated.

Regards,

-Farooq.
--
Mir Farooq Ali

Computer Science, Virginia Tech,
Email: miali@xxxxxxxxx
Web: http://purl.org/net/farooq
--------------------------------------------
(c) 2004 Mir Farooq Ali  All rights reserved
--------------------------------------------


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list






XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


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.