posted 10 years ago
This line of code:
tells the XSLT processor to apply its rules to all children of the root element, because it's called when the root element is being processed. You've provided a rule for anything matching "work/cd", so that gets called for each of your work/cd elements. And that's what you want. But the other children of the root element, you haven't provided any rules. So the XSLT processor applies its default rules.
Roughly speaking (because I haven't looked up the exact details) the default processing rules are these:
For an element node, apply the processing rules to each child successively.For a text node, write the contents of the node to the output.
And the rules are applied recursively. So first it finds an <abc> element and applies the rules... which means it applies the rules to the <xyz> child... I leave you to work out how it goes from there.
I expect you also want to know what to do about it. Well, just don't apply-templates to all children in that line of code. Use its "select" attribute to say which children you want to apply templates to.