xsl-list
[Top] [All Lists]

AW: Formatting XSL for XML to CSV translation

2003-09-18 08:04:46
Dear Stuart,

Try to put the commata between the elements in an text element: 

<xsl:text>,</text> 

This should work, but it isn't yet the best for readability.


Best wishes
Hendrik


-----Ursprüngliche Nachricht-----
Von: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] Im Auftrag 
von 
Stuart Jones
Gesendet: Donnerstag, 18. September 2003 16:47
An: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: [xsl] Formatting XSL for XML to CSV translation


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



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



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