[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Transforming XML to CSV

Subject: RE: Transforming XML to CSV
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 15 Oct 2002 15:49:29 +0300
transforming xml to csv
FAQ,

> I wish to transform XML which looks like this:
> 
> <row>
>       <column>Value 1</column>
>       <column>Value 2</column>
>       <column>Value 3</column>
> </row>
> <row>
>       <column>Value 4</column>
>       <column>Value 5</column>
>       <column>Value 6</column>
> </row>
> 
> 
> Into a comma separated values (CSV) format looking like this:
> 
> "Value 1","Value 2", "Value 3"
> "Value 4","Value 5", "Value 6"
> 
> so it can be read in a spreadsheet program.  What XSL will do 
> this?  I'm
> having trouble because the result is not a hierarchical result.

<xsl:template match="row">
  <xsl:for-each select="column">
    <xsl:if text="not(position() = 1)">,</xsl:if>
    <xsl:value-of select="." />
  </xsl:for-each>
  <xsl:text>&#xA;</xsl:text>
<xsl:template>

Cheers,

Jarno

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.