1

I need a software for converting xml files to csv. It has to run on Windows Server 2012 / 2016 on command line. The software must have good support (updates, live help etc..)

2
  • Are you OK to write sample XSLT file? Sep 24 at 14:31
  • hi yes can give it a go
    – Rosebud
    Sep 26 at 19:46
1

You can use this XSLT:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="iso-8859-1"/>

<xsl:strip-space elements="*" />

<xsl:template match="/*/child::*">
<xsl:for-each select="child::*">
<xsl:if test="position() != last()">"<xsl:value-of select="normalize-space(.)"/>",    </xsl:if>
<xsl:if test="position()  = last()">"<xsl:value-of select="normalize-space(.)"/>"<xsl:text>&#xD;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

And use xsltproc with this stylesheet to convert to CSV. For reference you can check this answer: https://stackoverflow.com/a/365338/2908599

Also you can try this tool xml2csv, it seems reported by people as working well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.