THE BORE

General => The Superdeep Borehole => Topic started by: GilloD on May 07, 2009, 04:19:51 PM

Title: Comp00ter dudez: How to insert a linebreak in an XSL when outputting to CSV?
Post by: GilloD on May 07, 2009, 04:19:51 PM
So, I have an XSL sheet that exports orders to our ERP in a CSV. Currently, everything exports to a single line. How do I insert a linebreak via the XSL? I've tried the usual &13 shit.
Title: Re: Comp00ter dudez: How to insert a linebreak in an XSL when outputting to CSV?
Post by: Howard Alan Treesong on May 07, 2009, 04:20:33 PM
\n ? I Dunno
Title: Re: Comp00ter dudez: How to insert a linebreak in an XSL when outputting to CSV?
Post by: GilloD on May 07, 2009, 04:30:42 PM
FOUND IT NO THANKS TO YOU :smug

But when I was going to make a CSV export using XSLT, the same formula didn’t work. After some googling and testing I found this solution: Use method=”text” and indent=”yes” in xsl:output. Use xsl text and put a line break (#x0D;) and use xml:space=”preserve”.

Note the key here is xml:space=”preserve”. Without it won’t work. It only worked if I added some text before the line break. But obviously, in a CSV, I don’t wont test at the end of the line.
Title: Re: Comp00ter dudez: How to insert a linebreak in an XSL when outputting to CSV?
Post by: recursivelyenumerable on May 07, 2009, 04:52:38 PM
I hope you're posting these questions to Stack Overflow and not just here.
Title: Re: Comp00ter dudez: How to insert a linebreak in an XSL when outputting to CSV?
Post by: GilloD on May 07, 2009, 05:17:43 PM
HA DURR. I did it wrong:

<xsl:text>&#13;</xsl:text>

Winner Dinner.