Re: [xsl] NEWLINES

Subject: Re: [xsl] NEWLINES
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Tue, 5 Mar 2002 15:27:53 -0500
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: [xsl] 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