N
NatDonin
Hi,
I'm new to XSLT and XML too, but I need your help with trying to create
an XSLT that will flatten my XML. I know I need to use nested loops
(for-each).
My XML file looks like this:
<File>
<Element1>
<Element2>
<Element3>
<Element31></Element31>
<Element32></Element32>
<Element4>
<Element41></Element41>
<Element42></Element42>
<Element5>
<Element51></Element51>
<Element52></Element52>
</Element5>
<Element6>
<Element61> Data1 </Element61>
<Element62> Data1 </Element62>
</Element6>
<Element6>
<Element61>Data2</Element61>
<Element62>Data2</Element62>
</Element6>
</Element4>
<Element4>
<Element41></Element41>
<Element42></Element42>
<Element5>
<Element51></Element51>
<Element52></Element52>
</Element5>
<Element6>
<Element61> Data3 </Element61>
<Element62> Data3 </Element62>
</Element6>
<Element6>
<Element61> Data4 </Element61>
<Element62> Data4 </Element62>
</Element6>
<Element6>
<Element61> Data5 </Element61>
<Element62> Data5 </Element62>
</Element6>
</Element4>
</Element3>
<Element3>
<Element31></Element31>
<Element32></Element32>
<Element4>
<Element41></Element41>
<Element42></Element42>
<Element5>
<Element51></Element51>
<Element52></Element52>
</Element5>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
</Element4>
<Element4>
<Element41></Element41>
<Element42></Element42>
<Element5>
<Element51></Element51>
<Element52></Element52>
</Element5>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
</Element4>
</Element3>
</File>
What I need to get is XML that looks like below:
<File>
<Element6>
<Element1>
<Element2>
<Element31></Element31>
<Element32></Element32>
<Element41></Element41>
<Element42></Element42>
<Element51></Element51>
<Element52></Element52>
<Element61> Data1 </Element61>
<Element62> Data1 </Element62>
</Element6>
<Element6>
<Element1>
<Element2>
<Element31></Element31>
<Element32></Element32>
<Element41></Element41>
<Element42></Element42>
<Element51></Element51>
<Element52></Element52>
<Element61> Data2 </Element61>
<Element62> Data2 </Element62>
</Element6>
<Element6>
<Element1>
<Element2>
<Element31></Element31>
<Element32></Element32>
<Element41></Element41>
<Element42></Element42>
<Element51></Element51>
<Element52></Element52>
<Element61> Data3 </Element61>
<Element62> Data3 </Element62>
</Element6>
<Element6>
<Element1>
<Element2>
<Element31></Element31>
<Element32></Element32>
<Element41></Element41>
<Element42></Element42>
<Element51></Element51>
<Element52></Element52>
<Element61> Data4 </Element61>
<Element62> Data4 </Element62>
</Element6>
...etc..
</File>
Appreciate any input!
Natalie
I'm new to XSLT and XML too, but I need your help with trying to create
an XSLT that will flatten my XML. I know I need to use nested loops
(for-each).
My XML file looks like this:
<File>
<Element1>
<Element2>
<Element3>
<Element31></Element31>
<Element32></Element32>
<Element4>
<Element41></Element41>
<Element42></Element42>
<Element5>
<Element51></Element51>
<Element52></Element52>
</Element5>
<Element6>
<Element61> Data1 </Element61>
<Element62> Data1 </Element62>
</Element6>
<Element6>
<Element61>Data2</Element61>
<Element62>Data2</Element62>
</Element6>
</Element4>
<Element4>
<Element41></Element41>
<Element42></Element42>
<Element5>
<Element51></Element51>
<Element52></Element52>
</Element5>
<Element6>
<Element61> Data3 </Element61>
<Element62> Data3 </Element62>
</Element6>
<Element6>
<Element61> Data4 </Element61>
<Element62> Data4 </Element62>
</Element6>
<Element6>
<Element61> Data5 </Element61>
<Element62> Data5 </Element62>
</Element6>
</Element4>
</Element3>
<Element3>
<Element31></Element31>
<Element32></Element32>
<Element4>
<Element41></Element41>
<Element42></Element42>
<Element5>
<Element51></Element51>
<Element52></Element52>
</Element5>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
</Element4>
<Element4>
<Element41></Element41>
<Element42></Element42>
<Element5>
<Element51></Element51>
<Element52></Element52>
</Element5>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
<Element6>
<Element61></Element61>
<Element62></Element62>
</Element6>
</Element4>
</Element3>
</File>
What I need to get is XML that looks like below:
<File>
<Element6>
<Element1>
<Element2>
<Element31></Element31>
<Element32></Element32>
<Element41></Element41>
<Element42></Element42>
<Element51></Element51>
<Element52></Element52>
<Element61> Data1 </Element61>
<Element62> Data1 </Element62>
</Element6>
<Element6>
<Element1>
<Element2>
<Element31></Element31>
<Element32></Element32>
<Element41></Element41>
<Element42></Element42>
<Element51></Element51>
<Element52></Element52>
<Element61> Data2 </Element61>
<Element62> Data2 </Element62>
</Element6>
<Element6>
<Element1>
<Element2>
<Element31></Element31>
<Element32></Element32>
<Element41></Element41>
<Element42></Element42>
<Element51></Element51>
<Element52></Element52>
<Element61> Data3 </Element61>
<Element62> Data3 </Element62>
</Element6>
<Element6>
<Element1>
<Element2>
<Element31></Element31>
<Element32></Element32>
<Element41></Element41>
<Element42></Element42>
<Element51></Element51>
<Element52></Element52>
<Element61> Data4 </Element61>
<Element62> Data4 </Element62>
</Element6>
...etc..
</File>
Appreciate any input!
Natalie