Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2007, 03:16 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default Inserting 'NewLine' in output

The XSLT I'm working on is outputting to a flat text file (actually, it's a csv file). But I need to put line breaks at specific locations.

I know I'm forgetting something fundamental here, but I guess that's why I'm asking; I've forgotten.

I've tried setting a variable:

<xsl:variable name="nl" select="x0A/>

then using it

<xsl:value-of select="$nl"/>

or
<xsl:text>&amp;#0A;</xsl:text> (the forum sw is eating my ampersand)

but that is apparently not the right way to do it.

Any clues on where I can find the answer?

I'm using Saxon8, I've got XPath 2.0 and XSLT 2.0 as well as Worx's Professional XML. But I'm not locating the solution.

------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
__________________
------------------------
Keep Moving Forward

GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
 
Old February 22nd, 2007, 03:29 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default

Nevermind, I was missong the 'x'

<xsl:text>&amp;#x0A;</xsl:text>

works.




------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
 
Old February 22nd, 2007, 07:17 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Use <xsl:output method="text"/>, and then use

<xsl:text>#x0a;</xsl:text>

to output the newline.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 22nd, 2007, 07:18 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

That should read

ampersand hash x 0 a semicolon.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Newline in VB Manisha0605 .NET Framework 1.x 3 February 4th, 2007 11:16 AM
inserting BLOB into MySQL DB, carriage newline jcsnyder PHP Databases 1 September 8th, 2006 12:51 PM
Problem with Newline character d_sathish XSLT 3 November 25th, 2005 07:20 PM
Newline in notepad, HOW.....???? veskoula XSLT 3 October 29th, 2003 10:49 AM
Output a newline entity reference quivogne XSLT 4 October 1st, 2003 01:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.