Reputation: 35
For the grouping function, is there a way to group by dynamic key, which is passed in the input data? For example, in the input xml below, I want to group <Trans>
by the node name passed in <key1>
, which is currently "id". Thank you!
<xsl:for-each-group select="Trans" group-by="[this key node name is from the input]">
Input xml:
<File>
<key1>id</key1>
<Trans>
<id>1</id>
<name>jane</name>
<location>ga</location>
<value>1.11</value>
</Trans>
<Trans>
<id>2</id>
<name>jane</name>
<location>ma</location>
<value>2.22</value>
</Trans>
<Trans>
<id>1</id>
<name>john</name>
<location>al</location>
<value>3.33</value>
</Trans>
<Trans>
<id>3</id>
<name>jj</name>
<location>ga</location>
<value>4.44</value>
</Trans> </File>
Upvotes: 0
Views: 41