1

Topic: Interesting conversion XSLT

At first the task seemed to me enough simple, but then I decided to address to professionals.
Initial XML:

<main>
<group name = "xxx">
<subgroup> value1 </subgroup>
<subgroup> value1 </subgroup>
<subgroup> value2 </subgroup>
<group name = "yyy">
<subgroup> value2 </subgroup>
<subgroup> value1 </subgroup>
<subgroup> value1 </subgroup>
<subgroup> value3 </subgroup>
<group name = "xxx">
<subgroup> value1 </subgroup>
<subgroup> value2 </subgroup>
</group>
</group>
</group>
</main>

The Result should be:

<main>
<subgroup group = "xxx" double = "5"> value1 </subgroup>
<subgroup group = "xxx" double = "5"> value1 </subgroup>
<subgroup group = "xxx" double = "3"> value2 </subgroup>
<subgroup group = "xxx/yyy" double = "3"> value2 </subgroup>
<subgroup group = "xxx/yyy" double = "5"> value1 </subgroup>
<subgroup group = "xxx/yyy" double = "5"> value1 </subgroup>
<subgroup group = "xxx/yyy/xxx" double = "5"> value1 </subgroup>
<subgroup group = "xxx/yyy/xxx" double = "3"> value2 </subgroup>
</main>

I Ask to pay attention on value3, it in an individual type, means in finite XML should miss.
My sincere gratitude to the one who can the task solve one XSLT-transformation. If the decision is two conversions, with good optimization on speed, at great volumes of the data.
I very much respect this forum, therefore the request - not to write nonsense!

2

Re: Interesting conversion XSLT

I Want to add three obvious conditions
1) the node group has the infinite enclosure.
2) the node subgroup only can be only a subgroup group, but also the infinite amount of times.
3) the amount of repetitions of all group is not restricted.

3

Re: Interesting conversion XSLT

And double by what principle it is put down?

4

Re: Interesting conversion XSLT

Antonariy,
the Good question , but nevertheless the answer to it is in the task.
double - repetition on all file, values [value...] .
I mentioned in the task about value3 not casually.

5

Re: Interesting conversion XSLT

Fridrih,
I would like to see the decision on version 1.0.

6

Re: Interesting conversion XSLT

Fridrih,
1) XSLT 2.0 - not a sin, but it will be less interesting.
2) I Will underline once again, the main thing productivity .
3) Indulgence - it is possible to apply the infinite amount of conversions.

7

Re: Interesting conversion XSLT

[quote = bc] Antonariy,
the Good question , but nevertheless the answer to it is in the task.
double - repetition on all file, values [value...] .
I mentioned in the task about value3 not casually.

glory b-gu other ciphered rebuses it is not visible