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

Re: Converting xml to csv with xslt


python xml to csv
Jerry Lake wrote:

> 
> I'm still working on my xslt. Can someone give me an example or point me
> in the right direction to convert my XML to CSV
> 

It's a transformation problem.  You have to decide what the csv should 
look like, given the xml source.

Since you will be outputting text, you need to specify the text output 
method in your xslt stylesheet.  The other thing you have to do is to 
write a little template that will add a comma after each field except 
for the last one in a row, and another that will escape fields whose 
text contains a comma.  These tasks are typically done with small 
recursive templates.

If you need to group items together in a way that they are not grouped 
in the xml source, you may need to use one or another of the standard 
grouping techniques.  Just look in the various on-line FAQs and xslt 
sites for grouping techniques and for these kinds of recursive templates.

Dave Pawson's site, and Jeni Tennison's site, would be really good 
starting references.

Start hanging out on the Mulberry xsl list.

Don't worry, xslt has been used for generating Python, javascript, SQL, 
and a host of other text formats.  It will work fine for csv.

Cheers,

Tom P

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.