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

Skeleton Merge

Subject: Skeleton Merge
From: Saran Toochinda <sarantoo@xxxxxxxxx>
Date: Tue, 23 Aug 2005 15:42:22 +0700
blank skeleton
I'm using XForms to collect XML data (company data, 1 file per
company). A skeleton of blank XML file which is based on a schema is
use to present the data input forms. Our schema is change from time to
time with additional data structure as well as corresponding XForms
control. There is no problem with the new file because it always based
on a new skeleton file. The problem arise on the existing files
because XForms bound it's control to existance of data element in
existing document. The newly added XForms controls don't get display
because there is no such data exist before.

My question is how can I merge newly added, blank element to an
existing file using XSLT to reflect the new data structure. For
example: merging existing.xml with skeleton.xml and looking for
somethink like the output below:

File existing.xml:

<company id="123">
   <name>ABC</name>
   <address>NJ</address>
   <phone>123456</phone>
   <fax>56789</fax>
   <branches>
        <branch>
            <name>Branch A</name>
        </branch>
        <branch>
            <name>Branch B</name>
        </branch>
   </branch>
</company>

File skeleton.xml with newly added element:

<company id="">
   <name/>
   <address/>
   <phone/>
   <fax/>
   <email/>              <!-- added -->
   <website/>           <!-- added -->
   <branches>
        <branch>
            <name/>
            <address/>    <!-- added -->
        </branch>
   </branch>
</company>

This is a needed output:

<company id="123">
   <name>ABC</name>
   <address>NJ</address>
   <phone>123456</phone>
   <fax>56789</fax>
   <email/>                           <!-- added -->
   <fax/>                               <!-- added -->
   <branches>
        <branch>
            <name>Branch A</name>
            <address/>               <!-- added -->
        </branch>
        <branch>
            <name>Branch B</name>
            <address/>               <!-- added -->
        </branch>
   </branch>
</company>


The actual schema is very complex and there are many schemas so
looking for a universal transform solution rather than hard coded per
element/file.

Many thanks in advance!

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.