[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Skeleton Merge
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!
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|