[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] XSLT Question regarding converting XML to CSV
Subject: Re: [xsl] XSLT Question regarding converting XML to CSV From: andrew welch <andrew.j.welch@xxxxxxxxx> Date: Mon, 28 Nov 2005 12:53:32 +0000 |
On 11/28/05, moshe malaver <malaver_m@xxxxxxxxx> wrote: > Hi, I need to simulate converting my XML to CSV aswell > as to HTML. > it was decided that rowspan and callspan should be > accounted also in csv in the following way. > XML : > <ROWS> > <ROW> > <USA> <rowspan>3</rowspan> > <colspan>2</colspan> > </USA> > <BOS> <colspan>2</colspan> > </BOS> > </ROW> > <ROW> > <NY> <colspan>2</colspan> > </NY> > </ROW> > <ROW> > <LA> <colspan>2</colspan> > </LA> > </ROW> > <ROW> > <CAN> <rowspan>2</rowspan> > <colspan>2</colspan> > </CAN> > <TOR> <colspan>2</colspan> > </TOR> > </ROW> > <ROW> > <VAN> <colspan>2</colspan> > </VAN> > </ROW> > </ROWS> > > The output CSV file should look something like: > > USA,,BOS,, > ,,NY,, > ,,LA,, > CAN,,TOR > ,,VAN > > How can I write my XSLT? You will need to normlize your XML to remove rowspans and colspans (which is tricky), which will then make generating the csv easy. A stylesheet I wrote a while back does table normalization, although you'll need to modify it to fit your XML: http://www.dpawson.co.uk/xsl/sect2/N7450.html#d9550e730 cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSLT Question regarding conve, moshe malaver | Thread | [xsl] node-set in .Net 2.0?, bryan rasmussen |
[xsl] XSLT Question regarding conve, moshe malaver | Date | [xsl] index grouping and sorting, Shailesh Shinde |
Month |
Keywords