Using identity tranform on XML nodes

blog — Tags: , , — anon @ 09/12 12:11 pm

Recently I needed to expose all the child nodes of a root node in a XML file. Not as trivial as I first thought. I was looking for a smart way to do this for some identically structured XML files. I ended up with some XSLT code that uses identity transformation to do what I need.

The following is a simplified sample of what I have.

<rootnode>
    <childnode>
        ...
    </childnode>
</rootnode>

And this is how I would like it to be.

<childnode>
    ...
</childnode>

The resulting code is very simple and easy to understand if you know the very basics of XSLT. There are different approaches that lead to slightly different code but the result is the same.

(more…)

copyright © 2008-2010 datenkompost.de/blog - barecity derivative | imprint
* a title remix inspired by a popular german book