[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Variations in XML to CSV
Subject: Re: Variations in XML to CSV
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 21 Apr 2011 15:58:01 +0100
|
It's hard to know from this description why you are struggling. There
are zillions of examples of XSLT stylesheets to convert XML to CSV out
there in google-land, and many of them work. I'd suggest you write some
code that you find promising, and if it doesn't work then we'll tell you
why. It's only when we see non-working code that we can work out where
you went wrong in your thinking.
Of course, we also need to know what CSV output you want to produce.
There are many different ways, for example, of handling the repeating
element "subject".
Michael Kay
Saxonica
On 21/04/2011 15:30, Bridger Dyson-Smith wrote:
Hi all,
thanks for taking a moment to read.
I'm trying to generate a CSV file from XML that looks something like this:
<root>
<metadata>
<title>Alpha</title>
<subject>Sinister</subject>
<creator>Beta</creator>
<subject>Gamma</subject>
<subject>Delta</subject>
<subject>Epsilon</subject>
<date>2011-04-19</date>
</metadata>
<metadata>
<title>Zeta</title>
<creator>Eta</creator>
<creator>Theta</creator>
<contributor>Dexter</contributor>
<contributor>Iota</contributor>
<subject>Kappa</subject>
<subject>Lambda</subject>
<date>2011-04-19</date>
</metadata>
</root>
I'm at a complete loss. I've been reading (and rereading) examples
from the XSLT Cookbook, but I haven't been able to make the examples
jive with what I'm looking at on my screen. Is this even possible? If
so, would someone mind giving me a push in the right direction?
I've been able to generate a dummy XML file that has a complete set of
all the elements:
<root>
<metadata>
<title>Value</title>
<subject>Value</subject>
<creator>Value</creator>
<creator>Value</creator>
<contributor>Value</contributor>
<subject>Value</subject>
<subject>Value</subject>
<subject>Value</subject>
<date>Value</date>
</metadata>
</root>
If I use this to generate a row of column names, I think I can map the
variable elements to their respective columns provided I can get that
aforementioned push. Maybe it needs to be a kick...
Thanks again for reading.
Cheers,
Bridger
Current Thread |
Michael Kay - 21 Apr 2011 14:58:12 -0000 <=
|
|
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
RSS 2.0 |
|
Atom 0.3 |
|
|