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

RE: Converting XML source to CSV output

Subject: RE: Converting XML source to CSV output
From: "Chris Pearson" <chrisp@xxxxxxxxxxx>
Date: Thu, 20 Sep 2001 12:24:41 -0400
RE:  Converting XML source to CSV output
THANK YOU All!  Your suggestions helped me get exactly what I was
looking for.
If anyone is curious, here's what I ended up using...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" media-type="text/plain" />
<xsl:strip-space elements="*"/>
<xsl:template match="//DETAIL">
   <xsl:variable name="detail" select="*/@value"/>
   <xsl:variable name="body" select="parent::BODY/*/@value"/>
   <xsl:variable name="header"
select="parent::BODY/preceding-sibling::HEADER[1]/*/@value"/>
   <xsl:variable name="all-elements" select="$header | $body |
$detail"/>
   <xsl:for-each select="$all-elements[position() != last()]">
      <xsl:value-of select="concat(.,',')"/>
   </xsl:for-each>
   <xsl:value-of select="concat($detail[last()], '&#xa;')"/>
</xsl:template>
</xsl:stylesheet>

Once again, a big thank you to all!

Chris

 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-2011 All Rights Reserved.