xsl-list
[Top] [All Lists]

Formatting XSL for XML to CSV translation

2003-09-18 07:46:50
Dear xsl-list

I am new to XSL and have been playing for a few days, using for my education 
the web (brilliant tool that it is). I want to use XSL to transform an XML 
document (generated by the ADODataSet.SaveToFile() method) into CSV format. All 
pretty straightforward for a novice, and I've achieved what I'm after - but I 
have an aesthetic question.

For readability I would prefer the XSL file to look nicely nested like this:

  <xsl:variable name="new_line" select="'&#013;'"/>
  <xsl:template match="/">

    <xsl:for-each select="xml/rs:data/z:row">
      <xsl:value-of select="@field1"/>,
      <xsl:value-of select="@field2"/>,
      ...
      <xsl:value-of select="@fieldn"/>
      <xsl:value-of select="$new_line"/>
    </xsl:for-each>

  </xsl:template>

Unfortunately, this means that each value ends up on its own line. Placing each 
element in one long line in the XSL solves the problem but is hard to read (to 
say the least).

Any ideas?

Thanks
Stuart

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



<Prev in Thread] Current Thread [Next in Thread>