This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes A better way to insert newlines? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "A better way to insert newlines?" Watch "A better way to insert newlines?" New topic
Author

A better way to insert newlines?

John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1449
Hi,
I've been using the following in a stylesheet to insert newlines in my output document:

I'm hoping someone can tell me a better way!
Thanks,
John


The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Originally posted by John Wetherbie:
Hi,
I've been using the following in a stylesheet to insert newlines in my output document:


Probably you can declare a variable newLine and initialies it to the new line and use it.


am not sure if this is what you were expecting
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1449
Well, I hadn't thought of that, so that makes it interesting. I'll certainly try it and see if it helps clean things up.
Any other proposals out there?
Thanks,
John
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
This is a quote from Michael Kay answering this question in Wrox's XSLT forum:
" Use <xslutput method="text">, and use <xsl:text>&#xa;</xsl:text> where you want the newline to appear.
Some people find it useful to declare this as an entity:
<!ENTITY nl "<xsl:text>&#xa;</xsl:text>">
so you can then simply write "&nl;" where you want the newline."
[ March 20, 2002: Message edited by: Mapraputa Is ]

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1449
OK. That looks good, too.
Is there a reason or reasons to use an entity vs. a variable or vice-versa?
John
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1449
Here's what I ended up doing. It seems to work pretty well.

John
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A better way to insert newlines?