Friday, September 13, 2013

XSL: Copy All Elements With Required Elements

This is an example of taking an XML document and passing it through an XSL transformation with a few key points.

  1. It makes sure that some elements not in the original XML will show up in the resulting XML
  2. It makes sure all elements in the original XML show up in the transformed XML
  3. It changes the root element
  4. It modifies an element tag and adds some text to it
So here is the original XML:

Here is the transformation file:

And here are the results:

It's also easy to verify and play around with at freeformatter.com.

No comments:

Post a Comment