I have this kind of xml
<?xml version="1.0"?>
<Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Rows>
<Row>
<Id>1</Id>
<XColumns>
<Name>Country</Name>
<Value>Austria</Value>
</XColumns>
<XColumns>
<Name>Region</Name>
<Value>Europe</Value>
</XColumns>
<XColumns>
<Name>Sector</Name>
<Value>Information Technology</Value>
</XColumns>
<YColumns>
<Name>Dataset 1</Name>
<Value>14</Value>
</YColumns>
<YColumns>
<Name>Dataset 2</Name>
<Value>19</Value>
</YColumns>
</Row>
<Row>
<Id>2</Id>
<XColumns>
<Name>Country</Name>
<Value>Bahamas</Value>
</XColumns>
<XColumns>
<Name>Region</Name>
<Value>North American</Value>
</XColumns>
<XColumns>
<Name>Sector</Name>
<Value>Information Technology</Value>
</XColumns>
<YColumns>
<Name>Dataset 1</Name>
<Value>1</Value>
</YColumns>
<YColumns>
<Name>Dataset 2</Name>
<Value>15</Value>
</YColumns>
</Row>
I need to convert it to following XML using XSLT
<?xml version="1.0"?>
<data>
<categories>
<category label="Austria"/>
<category label="Bahamas"/>
</categories>
<dataset seriesName="DataSet 1">
<set value="14"/>
<set value="1"/>
</dataset>
<dataset seriesName="DataSet 2">
<set value="19"/>
<set value="15"/>
</dataset>
1 more thing, i have one variable called "category", if i pass category=Country so it will generate categories tag where label have value of country like Austria,Bahamas . if i pass category = region so it will generate categories tag where label have value of region like Europe, North American. So based upon category value i have to generate categories tag.