Author Topic: Comp00ter dudez: How to insert a linebreak in an XSL when outputting to CSV?  (Read 525 times)

0 Members and 1 Guest are viewing this topic.

GilloD

  • TAKE THE LIFE OF FRED ASTAIRE. MAKE HIM PAY. TRANSFER HIS FAME TO YOU.
  • Senior Member
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.
wha

Howard Alan Treesong

  • キング・メタル・ドラゴン
  • Icon
\n ? I Dunno
乱学者

GilloD

  • TAKE THE LIFE OF FRED ASTAIRE. MAKE HIM PAY. TRANSFER HIS FAME TO YOU.
  • Senior Member
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.
wha

recursivelyenumerable

  • you might think that; I couldn't possibly comment
  • Senior Member
I hope you're posting these questions to Stack Overflow and not just here.
QED

GilloD

  • TAKE THE LIFE OF FRED ASTAIRE. MAKE HIM PAY. TRANSFER HIS FAME TO YOU.
  • Senior Member
HA DURR. I did it wrong:

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

Winner Dinner.
wha