|
next
|
 Subject: Extract values from XML and convert to CSV using XSLT Author: Ivan Pedruzzi Date: 25 Oct 2004 05:26 PM
|
Hi Edward,
Could you be more specific about what would you like to output?
CSV is just a text format to render tabular data.
Which elements would you like to map to which columns?
Here is an example of XSLT that applied to your XML document produces a CSV document, it may be enough to get you started
Hope this helps
Ivan
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:variable name="separator" select="';'"/>
<xsl:template match="/">
<xsl:value-of select="concat('FragmentId', $separator, 'NPIC50DP', $separator, 'NPIC50EP2', $separator, 'NPSolubility')"/><xsl:text>
</xsl:text>
<xsl:apply-templates select="FragmentModel/Fragment"/>
</xsl:template>
<xsl:template match="Fragment">
<xsl:value-of select="concat(@FragmentId, $separator, NPIC50DP, $separator, NPIC50EP2, $separator, NPSolubility)"/><xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
|
|
|
|