I am using XSLT to create CSV file from XML file.
currently my xml file looks like
<VWSRecipeFile>
<PDCScaling User="" Version="1.0" Description="PDCTesting" LastChange="41984.7673783102">
<Values>
<Ch1_MLC_Application_GVLPDC_PDC_Body_Sca_GrossWeightTopFlash_Set Item="Upper flash_set" Unit="kg" Type="4" Hex="00000000" Value="0"/>
<Ch1_MLC_Application_GVLPDC_PDC_Body_Sca_GrossWeightTopFlash_Act Item="Upper flash_act" Unit="kg" Type="4" Hex="00000000" Value="0"/>
<Ch1_MLC_Application_GVLPDC_PDC_Body_Sca_GrossWeightTopFlash_TolUpp Item="Upper flash_max" Unit="kg" Type="4" Hex="00000000" Value="0"/>
</Values>
</PDCScaling>
</VWSRecipeFile>
And my xslt looks like
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="no"/>
<xsl:template match="/VWSRecipeFile">
<xsl:for-each select="PDCScaling/Values/*">
<xsl:value-of select="concat(@Item,';')" />
</xsl:for-each>
<xsl:text>
</xsl:text>
<xsl:for-each select="PDCScaling/Values/*">
<xsl:value-of select="concat(@Unit,';')" />
</xsl:for-each>
<xsl:text>
</xsl:text>
<xsl:for-each select="PDCScaling/Values/*">
<xsl:value-of select="concat(@Value,';')" />
</xsl:for-each>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
Now there is change in xml file and it looks like
<VWSRecipeFile>
<PDCScaling User="" Version="1.0" Description="PDCTesting" LastChange="41984.7673783102">
<Values>
<Ch1_MLC_Application_GVLPDC_PDC_Body_Sca_GrossWeightTopFlash_Set Item="Upper flash_set_kg" Type="4" Hex="00000000" Value="0"/>
<Ch1_MLC_Application_GVLPDC_PDC_Body_Sca_GrossWeightTopFlash_Act Item="Upper flash_act_kg" Type="4" Hex="00000000" Value="0"/>
<Ch1_MLC_Application_GVLPDC_PDC_Body_Sca_GrossWeightTopFlash_TolUpp Item="Upper flash_max_kg" Type="4" Hex="00000000" Value="0"/>
</Values>
</PDCScaling>
</VWSRecipeFile>
What's changed is, in current file "Item" and "Unit" is merged and is given like "Item_unit". I want to produce same reults as before. For which before creating a CSV i need to break the "Item" into "Item" and "Unit" and then create the CSV. Can anyone tell me efficient way of doing it. Any help is appreciated