Can you please help me on how to do this xml: The xml looks like
<a name="hr_1" id="hr">
<text>11</text>
</a>
<a name="hr_2" id="hr">
<text>12</text>
</a>
<a name="hre_1" id ="hre">
<text>11</text>
</a>
<a name="hre_2" id ="hre">
<text>12</text>
</a>
expected output:The transformed output is expected like below
<b name ="hr">
<value>11</value>
<value>12</value>
</b>
<b name ="hre">
<value>11</value>
<value>12</value>
</b>
Seems like a simple grouping task then, solvable in XSLT 2 or 3 with
xsl:for-each-group
:Assumes
root
is the common container element for thea
elements to be grouped, adapt that as needed.From comment:
In XSLT 1.0, use Muenchian Grouping. What I would do is create a key matching all
text
elements and using theid
attribute of the parent...XML
XSLT 1.0
Output