Formatting XML using XSLT1.0
Posted
by DS
on Stack Overflow
See other posts from Stack Overflow
or by DS
Published on 2010-05-06T00:11:08Z
Indexed on
2010/05/06
0:18 UTC
Read the original article
Hit count: 528
xslt-1.0
Hi,
I have the following xml:
<Subscriptions>
<Subscription>
<Uplink>
<Size>15</Size>
<Unit>Mbps</Unit>
</Uplink>
<Name>Class D</Name>
</Subscription>
<Subscription>
<Uplink>
<Size>10</Size>
<Unit>Mbps</Unit>
</Uplink>
<Name>Class A</Name>
</Subscription>
<Subscription>
<Downlink>
<Size>50</Size>
<Unit>Mbps</Unit>
</Downlink>
<Name>Class B</Name>
</Subscription>
<Subscription>
<Uplink>
<Size>10</Size>
<Unit>Mbps</Unit>
</Uplink>
<Name>Class B</Name>
</Subscription>
<Subscription>
<Downlink>
<Size>40000</Size>
<Unit>Mbps</Unit>
</Downlink>
<Name>Class A</Name>
</Subscription>
<Subscription>
<Downlink>
<Size>20</Size>
<Unit>Mbps</Unit>
</Downlink>
<Name>Class C</Name>
</Subscription>
<Subscription>
<Downlink>
<Size>45</Size>
<Unit>Mbps</Unit>
</Downlink>
<Name>Class D</Name>
</Subscription>
</Subscriptions>
I want to group it in the following format based on name using XSLT1.0. Please help
<?xml version="1.0" encoding="UTF-8"?>
<Subscriptions>
<Subscription>
<Downlink>
<Size>45</Size>
<Unit>Mbps</Unit>
</Downlink>
<Uplink>
<Size>15</Size>
<Unit>Mbps</Unit>
</Uplink>
<Name>Class D</Name>
</Subscription>
<Subscription>
<Downlink>
<Size>40000</Size>
<Unit>Mbps</Unit>
</Downlink>
<Uplink>
<Size>10</Size>
<Unit>Mbps</Unit>
</Uplink>
<Name>Class A</Name>
</Subscription>
<Subscription>
<Downlink>
<Size>50</Size>
<Unit>Mbps</Unit>
</Downlink>
<Uplink>
<Size>10</Size>
<Unit>Mbps</Unit>
</Uplink>
<Name>Class B</Name>
</Subscription>
<Subscription>
<Downlink>
<Size>20</Size>
<Unit>Mbps</Unit>
</Downlink>
<Uplink>
<Size>0</Size>
<Unit>Mbps</Unit>
</Uplink>
<Name>Class C</Name>
</Subscription>
</Subscriptions>
Thanks & Regards, D
© Stack Overflow or respective owner