XSL Transform XML to CSV



Since Comma Separated Value (CSV) files are so common, here is a transformation.  It requires “Vocabulary.xml” and a translator.



<?xml version=”1.0″?>


<!— Created by Noah Coad, coad.net/noah, noah@coad.net, 3/23/04 —>


<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=”Set”/>

   <xsl:template match=”/Vocabulary”>Word,Description

<xsl:apply-templates select=”Set”>

         <xsl:sort select=”Word”/>




   <xsl:template match=”Set”>

      <xsl:value-of select=”Word”/>,”<xsl:value-of select=”Desc”/><xsl:text> </xsl:text>





Leave a Reply

Your email address will not be published. Required fields are marked *