Hi,
I'm wondering if anybody could help me with the following?
It seems this "problem" is not trivial - at least not to me ;-)
I have this XML:
which I want to transform to the following using XSL (the number of row nodes is not fixed):
Please notice that the metadata node (in the source XML) contains the names to be used in the resulting XML file as attribute names and that the name can contain one or more spaces (as indicated below in the name "Product yype").
Another issue is that there are two <value> per <row></row> and the first of these needs to be transformed to "Product_Type" and the second needs to be transformed to "Quantity" (or whatever the <metadata> node dictates).
Thank you very much in advance...
I'm wondering if anybody could help me with the following?
It seems this "problem" is not trivial - at least not to me ;-)
I have this XML:
Code:
<?xml version="1.0" encoding="utf-8"?>
<dataset xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/xmldata/1/"[/URL] xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance">[/URL]
<!--
<dataset
xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/xmldata/1/"[/URL]
xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL]
xs:schemaLocation="[URL unfurl="true"]http://developer.cognos.com/schemas/xmldata/1/[/URL] xmldata.xsd"
>
-->
<metadata>
<item name="Product type" type="xs:string" length="102"/>
<item name="Quantity" type="xs:int" precision="1"/>
</metadata>
<data>
<row>
<value>Binoculars</value>
<value>1075087</value>
</row>
<row>
<value>Climbing Accessories</value>
<value>5850251</value>
</row>
<row>
<value>Cooking Gear</value>
<value>13400351</value>
</row>
</data>
</dataset>
which I want to transform to the following using XSL (the number of row nodes is not fixed):
Code:
<?xml version="1.0" encoding="utf-8"?>
<data>
<row
ProductType="Binoculars"
Quantity="1075087"
/>
<row
ProductType="Climbing Accessories"
Quantity="5850251"
/>
<row
ProductType="Cooking Gear"
Quantity="13400351"
/>
</data>
Please notice that the metadata node (in the source XML) contains the names to be used in the resulting XML file as attribute names and that the name can contain one or more spaces (as indicated below in the name "Product yype").
Code:
<metadata>
<item name="[b]Product type[/b]" type="xs:string" length="102"/>
<item name="Quantity" type="xs:int" precision="1"/>
</metadata>
Another issue is that there are two <value> per <row></row> and the first of these needs to be transformed to "Product_Type" and the second needs to be transformed to "Quantity" (or whatever the <metadata> node dictates).
Thank you very much in advance...