my dog learned polymorphism
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply 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: 1441
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: 1441
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: 1441
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: 1441
Here's what I ended up doing. It seems to work pretty well.

John
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: A better way to insert newlines?
 
Similar Threads
Embedding XML tags in XSL
Converting XML into legacy record layout
XSLT/FF
XSL Doctype Declaration
Data Structure for logic tree