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

AW: XML Query!

Subject: AW: XML Query!
From: Delaney Robin <Robin.Delaney@xxxxxxx>
Date: Fri, 10 Jan 2003 12:36:21 +0100
csv from xml
Hello Rakesh,

I hope not, otherwise I spent a few days wasting my time before Xmas :-)

I had a need also to create CSV from XML and with the help of the many
"unsung heroes" in xsl-list, whose patience and willingness to share
knowledge amazes me at times, I managed to do what I needed. Here's a piece
of what I ended up with. You'll have to change it to suit your needs but it
does the basics. It only extracts the element and attribute values of "leaf
nodes" (descendants that don't have children). The seperator is currently a
"!". 

Hope it helps.

############################
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="text"/>
 	<xsl:template match="xyz">
  		  	<xsl:for-each select="(.//*[not(*)]|.//@*)"
				<xsl:value-of select="."/>	
				<xsl:if test="position()!=last()">!</xsl:if>

			</xsl:for-each> 
			<xsl:text>&#10;</xsl:text>

  	</xsl:template>
    </xsl:stylesheet>
############################


Cheers,

Robin
                                                     
Robin Delaney
FJA Feilmeier & Junker GmbH		    
web  http://www.fja.com

> -----Ursprüngliche Nachricht-----
> Von:	Rakesh Seth [SMTP:RakeshSeth@xxxxxxxxxx]
> Gesendet am:	Freitag, 10. Januar 2003 11:08
> An:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff:	 XML Query!
> 
> Hi
> I want to convert XML data into a csv file.Is there any parser available
> for that?
> 
> Rakesh Sheth
> rakeshseth@xxxxxxxxxx
> rakeshsheth@xxxxxx
> Tel.No.-6952222
> Extn.No.-1122
> Tel.No.(Resi.)-3802293
> 
> 
> 
> 
> MASTEK
> Investing in relationships
> In the US, we're called MAJESCO
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This
> e-mail and attachments (if any) transmitted with it are confidential
> and/or privileged and solely for the use of the intended person or entity
> to which it is addressed. Any review, re-transmission, dissemination or
> other use of or taking of any action in reliance upon this information by
> persons or entities other than the intended recipient is prohibited. This
> e-mail and its attachments have been scanned for the presence of computer
> viruses. It is the responsibility of the recipient to run the virus check
> on e-mails and attachments before opening them. If you have received this
> e-mail in error, kindly delete this e-mail from all computers.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

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


Current Thread
  • AW: XML Query!
    • Delaney Robin - Fri, 10 Jan 2003 06:35:46 -0500 (EST) <=

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.