I wish to transform an XML message to a CSV file, however I have some requirements of which I'm not sure I'm going to solve using XSLT.
First the original XML file:
<ProductInformation>
<Products>
<Product ID="itemid-00001" UserTypeID="objectType" ParentID="objectType2">
<KeyValue KeyID="keyItemNumber">123456</KeyValue>
<Name>123456</Name>
<AttributeLink AttributeID="sizeNumeric" Inherited="2">
<MetaData>
<Value AttributeID="sequence">2</Value>
<Value AttributeID="CPS" ID="1">1</Value>
</MetaData>
</AttributeLink>
<AttributeLink AttributeID="primaryColor" Inherited="2">
<MetaData>
<Value AttributeID="sequence">3</Value>
<Value AttributeID="CPS" ID="1">1</Value>
</MetaData>
</AttributeLink>
<AttributeLink AttributeID="secondaryColour_" Inherited="2">
<MetaData>
<Value AttributeID="sequence">10</Value>
</MetaData>
</AttributeLink>
<Values>
<Value AttributeID="sizeNumeric">0.01</Value>
<Value AttributeID="secondaryColour_" ID="Red">Red</Value>
</Values>
</Product>
</Products>
</ProductInformation>
From this XML file I wish to retrieve the values for all attributelinks which have a CPS score of 1. I want to create an extra column in my CSV for each attributelink that has a CPS property of 1. Then I want to put the matching values in the correct column. This XML will also contain multiple items which can all have their own unique attributeLinks and corresponding CPS-scores.
In this example the resulting CSV file should look like this;
Item;sizeNumeric;primaryColor
123456;0.01;;
Is something like this possible to do using XSLT?
Thanks in advance!
Productin the XML maps to a line in the CSV? As for the header lines, if "multiple items which can all have their own unique attributeLinks and corresponding CPS-scores" do you simply output a new header line of column names for eachProduct?