[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: NEWLINES

Subject: Re: NEWLINES
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Tue, 5 Mar 2002 15:27:53 -0500
introducing newline in xslt
Cutlass has given an excellent reference, but I will add just one point.  If
you are trying to produce text output (and if you are not, there's rarely
much point in trying to control the newlines precisely), unexpected
whitespace usually comes from whitespace between stylesheet elements.

This is in the FAQ, but there is a quick and dirty way to handle these
problems.  It's drawback is that is makes the stylesheet hard to read.  So
you should get the stylesheet first, except for extra newlines, then apply
this technique.

Here goes.  To prevent the stylesheet from introducing a newline, you play
games with the closing bracket of an start tag or empty element tag, like
this:

Original:

<xsl:value-of select='xxx'/>
<xsl:value-of select='yyy'/>

This may produce

XXX
YYY

Hacked version:

<xsl:value-of select='xxx'
/><xsl:value-of select='yyy'/>

This would produce

XXXYYY

I have used this (rather awful) technique in producing javascript where I
needed to control linefeeds (either for correct syntax or for readability).
It has worked where I couldn't get anything else to.

There - I've confessed!

Cheers,

Tom P


[cutlass]
>
> as much as  this list is about answering questions..... there is some
> expectation that you have searched the archives first or gained one of the
> excellant xslt reference books ( of which the authors troll through this
> list daily ).
>
> all of your questions for the day have been answered many many times in
> prev... posts over the years.
>
> to understand your problem go here
> http://www.dpawson.co.uk/xsl/sect2/N8321.html
>
> this will give u an overview of how to deal with this
>
> chow, jim fuller
>
> ----- Original Message -----
> From: "Kim Durand" <vsd18@xxxxxxxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, March 05, 2002 6:53 PM
> Subject:  NEWLINES
>
>
> > is there a way to remove unwanted newlines from the output??
> >
> > i am getting for some reasons, unwanted newlines in the output. i
> > want to get rid of them. please help someone



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.