xsl-list
[Top] [All Lists]

Re: XML To CSV

2004-07-29 07:56:53

Hi Andrew,
The following stylesheet :

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
   <xsl:output method="text"/>

   <xsl:template match="/">
      <xsl:apply-templates select="//Account[1]/descendant::*" />
   </xsl:template>

   <xsl:template match="*">
      <xsl:if test = "normalize-space(text())!=''" >
         <xsl:value-of select = "." />
         <xsl:if test = "not(position()=last())" >
            <xsl:text >,</xsl:text>
         </xsl:if>
      </xsl:if>
   </xsl:template>
</xsl:stylesheet>

gives the output :
1000748,1,1052.35,Mr,Joe,Bloggs

Is this what you want ?

Regards
AR


<Prev in Thread] Current Thread [Next in Thread>
  • Re: XML To CSV, Roy <=