Hi. I have an XML document that I want to perform an XSL transformation on and I'm not sure how to get the results I want. Let me give an example of the original and desired documents.
I'd like to use an XSL transformation to create an EXACT COPY of the original XML document plus a modification in the XML node hierarchy so that if a "SubShot" exists, it replaces its "Shot" parent node.
Desired XML:
Everything I read about XSL transformations indicates that this should be possible, 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 I suspect the XSL solution would be more elegant and extensible. Humble cries for help from an XSL rookie.
Best regards,
ADK.
Code:
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 original XML document plus a modification in the XML node hierarchy so that if a "SubShot" exists, it replaces its "Shot" parent node.
Desired XML:
Code:
<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 be possible, 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 I suspect the XSL solution would be more elegant and extensible. Humble cries for help from an XSL rookie.
Best regards,
ADK.