[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: converting XML to comma-separated value text file
> 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
|
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
|