I have a number of XML files containing lots of overhead. I wish to keep only about 20 specific elements and filter out anything else. I know all the names of the elements I want to keep, I also know whether or not they are child elements and who are their parents. These elements that I want to keep after the transformation need to still have their original hierarchic placement.
E.g. I want to keep ONLY
<ns:currency>
in;
<ns:stuff>
<ns:things>
<ns:currency>somecurrency</ns:currency>
<ns:currency_code/>
<ns:currency_code2/>
<ns:currency_code3/>
<ns:currency_code4/>
</ns:things>
</ns:stuff>
And make it look like this;
<ns:stuff>
<ns:things>
<ns:currency>somecurrency</ns:currency>
</ns:things>
</ns:stuff>
What would be the best way of constructing an XSLT to accomplish this?