[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Merging structure and content by own id with XSLT 2.0
Good day, I need to merge new data into an existing data set. Data is identified by data_id's. How does one merge the structure, content and attributes of XML files? This is a complex question, and I don't expect anyone to answer it in full. I'm quite willing to spend a couple of days on it. I am basically asking for some advise to get me down the right track. Obviously I'm not going to cry if an XSL guru can type out bits of the required XSL or just jot down some pseudo code. My greatest concern with XSL is getting the flow right. Coming from a C background this functional approach is still getting the better of me. Original data: <a data_id="1"> AAA </a> <b data_id="2"> BBB <c data_id="3"> CCC </c> <e data_id="5"> EEE </e> </b> <d data_id="4" width="2" color="blue"> DDD </d> New data: <d-d data_id="4" color="green"> D-D-D <c data_id="3"> CCC </c> </d-d> XSLT ??? Expected result: <a data_id="1"> AAA </a> <b data_id="2"> BBB <e custom_id="5"> data </e> </b> <dd data_id="4" width="2" color="green"> D-D-D <c data_id="3"> CCC </c> </dd> The rules are: - data_id's are unique in the result set - new data content replaces original content - new data structure modifies original structure - new attributes updates or adds to original element attributes - element names can be updated by new element names because only data_id's are used - all original elements with data_id's that are not in the new data, remains where they are, as they are Kind regards, Jacobus
|
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
|