This flat XML represents tree structure using level field. How can I get elements that are deeper in the tree to the given node but only in the same branch?
So given that company name is A and I need to get company B and C (not E which is in different branch).
<Companies>
<Company>
<Name>A</Name>
<Level>0</Level>
</Company>
<Company>
<Name>B</Name>
<Level>1</Level>
</Company>
<Company>
<Name>C</Name>
<Level>1</Level>
</Company>
<Company>
<Name>D</Name>
<Level>0</Level>
</Company>
<Company>
<Name>E</Name>
<Level>1</Level>
</Company>
</Companies>
There can be more than level one. I want it returned too.
I am using XLST 1.0.
Assume the focus node (current()) is the basis of your calculation.
Define…
Then the child companies are at the intersection of these two sets, which is…