Changing an XML document using XSL transformations

wxdqz

New Member
Hi. I have an XML document that I want to perform an XSL transformation onand I'm not sure how to get the results I want. Let me give an example ofthe original and desired documents.Original XML:<Material_Description Material_ID="MyVideo"><Volume Material_ID="MyVideo"><Label>MyVideoFootage</Label><Shot Material_ID="Shot1"><In_Frame /><Out_Frame /><Shot Material_ID="SubShot1a"><In_Frame /><Out_Frame /></Shot><Shot Material_ID="SubShot1b"><In_Frame /><Out_Frame /></Shot></Shot><Shot Material_ID="Shot2"><In_Frame /><Out_Frame /></Shot><Volume></Material_Description>I'd like to use an XSL transformation to create an EXACT COPY of the originalXML document plus a modification in the XML node hierarchy so that if a "SubShot"exists, it replaces its "Shot" parent node.Desired XML:<Material_Description Material_ID="MyVideo"><Volume Material_ID="MyVideo"><Label>MyVideoFootage</Label><Shot Material_ID="SubShot1a"><In_Frame /><Out_Frame /></Shot><Shot Material_ID="SubShot1b"><In_Frame /><Out_Frame /></Shot><Shot Material_ID="Shot2"><In_Frame /><Out_Frame /></Shot><Volume></Material_Description>Everything I read about XSL transformations indicates that this should bepossible, but I can't work out the syntax to achieve the desired result.I believe I could solve this using a DOM, but I'm very new to XSL and Isuspect the XSL solution would be more elegant and extensible. Humble criesfor help from an XSL rookie.Best regards,ADK.
 
Back
Top