I have an XML like this:
<?xml version="1.0" encoding="UTF-8"?>
<row>
<cell colname="1"><Name>SomeValue<Ref format="Ref" Idref="ABC"/></Name></cell>
<cell colname="2"><Selection>
<Config><Configuration>AAA</Configuration></Config>
<Config><Configuration>BBB</Configuration></Config>
</Selection></cell>
<cell colname="6"><Notes>
<Text><IteratorDef>
<IteratorTag Id="ABC">DDi</IteratorTag>
<IteratorList>
<IteratorChoice>05</IteratorChoice>
<IteratorChoice>10</IteratorChoice>
<IteratorChoice>15</IteratorChoice>
</IteratorList>
</IteratorDef></Text>
</Notes></cell>
</row>
I’d like to get the result like this:
The Ref points to the IteratorTag:
There are two Configuration namely AAA and BBB. For each Configuration there are several IteratorChoice values. Each need to be concatenated with the Name value + IteratorTag value so SomeValue+DDi+05, SomeValue+DDi+10, and SomeValue+DDi+15.
AAA
SomeValueDDi05
SomeValueDDi10
SomeValueDDi15
BBB
SomeValueDDi05
SomeValueDDi10
SomeValueDDi15
My thought is write a loop in a loop with for-each keying on IteratorList and Configuration tags (Configuration loop will be inside IteratorList loop), is this the correct approach using XSLT ?.
TIA,
John
solution1: this works only on provided input.
Here is the code:
If this is your XML:
This would be your output: