Subject: Re: [xsl] converting XML to comma-separated value text file From: "Bob DuCharme" <bob@xxxxxxxxx> Date: Tue, 19 Jun 2001 16:24:46 -0400 |
> I've been surfing the web for a couple hours, but can't find a basic > discussion of how to convert XML to a CSV text file. > (My background: I have modified pre-existing XSL stylesheets to convert > the following type of XML into HTML.) Thanks! If you want general advice, put an <xsl:output method="text"/> element at the beginning of your stylesheet so that characters like < and & don't get escaped, and then output your attribute values with <xsl:value-of select="@attributeName"/> (each followed by a comma) and your element text content with either a similar xsl:value-of element (without the @, of course) or or by using the default XSLT template rules, which output element content. (In the latter case, put your commas after the appropriate xsl:apply-templates elements.) You may need some xsl:text elements here and there to control the appearance of carriage returns. There's a brief example in my book of creating CSV files in my book. If you want more specific advice, you'll have to show us what you tried and what went wrong. Bob DuCharme www.snee.com/bob <bob@ snee.com> see http://www.snee.com/bob/xsltquickly for info on new book "XSLT Quickly" from Manning Publications. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] converting XML to comma-separ, Kevin . Wilson | Thread | RE:[xsl] converting XML to comma-se, VZAKON |
Re: [xsl] Remove a quote in a strin, Bob DuCharme | Date | RE:[xsl] converting XML to comma-se, VZAKON |
Month |