Modify XML files using XSLT

XSLT can be great for transforming XML files, especially where information is stored in attributes thanks to the @ operator.

If you have a xml file like:

The elements can be combined into one with multiple attributes, ie:

<collection>
<field row0=”Value0″ row1=”Value1″ row2=”Value2″ row3=”Value3″ row4=”Value4″ row5=”Value5″ row6=”Value6″ row7=”Value7″ row8=”Value8″ row9=“Value9”></field>
</collection>

using the following XSLT:

A web search will reveal many handy online testing tools, such as:
http://xslt.online-toolz.com/tools/xslt-transformation.php

Additionally, many IDEs now come with tools and verifiers build in to facilitate XSLT translation of XML files. As much as we prefer using JSON where possible these days, XSLT can adds an extraordinary amount of functionality and flexibility to XML files.

Advertisements

Leave a Reply