Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A better way to insert newlines?

 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's what I ended up doing. It seems to work pretty well.

John
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic