|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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()], '
')"/>
</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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






