Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > controlling whitespace with output method=html

Reply
Thread Tools

controlling whitespace with output method=html

 
 
Andy Fish
Guest
Posts: n/a
 
      06-14-2004
Hi,

I was wondering if there is any way to control the whitespace (specifically
line breaks) that are generated using Xalan XSLT processor with output
method=html.

I find it sometimes generates a line feed character before a <br>, even
where I have no whitespace between the <br /> and the next HTML tag in my
xsl. This wouldn't normally be a problem but it seems that sometimes this
upsets IE and causes it to put an extra blank line in the HTML page.

Andy


 
Reply With Quote
 
 
 
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      06-15-2004
In article <abkzc.4357$>,
Andy Fish <> wrote:

% I was wondering if there is any way to control the whitespace (specifically
% line breaks) that are generated using Xalan XSLT processor with output
% method=html.

In general, if you put all literal text in xsl:text elements, the processor
will spit out only what you tell it to. If you emit literal text which is
not wrapped up in xsl:text, the processor will typically emit all the text
nodes in the same template, including the new-lines. This may be the
problem you're having.

--

Patrick TJ McPhee
East York Canada

 
Reply With Quote
 
 
 
 
Andy Fish
Guest
Posts: n/a
 
      06-15-2004

"Patrick TJ McPhee" <> wrote in message
news:calh0c$sfj$...
> In article <abkzc.4357$>,
> Andy Fish <> wrote:
>
> % I was wondering if there is any way to control the whitespace

(specifically
> % line breaks) that are generated using Xalan XSLT processor with output
> % method=html.
>
> In general, if you put all literal text in xsl:text elements, the

processor
> will spit out only what you tell it to. If you emit literal text which is
> not wrapped up in xsl:text, the processor will typically emit all the text
> nodes in the same template, including the new-lines. This may be the
> problem you're having.
>


the problem I'm having is that even when I jam up the HTML fragment in the
xsl file with no whitespace at all, it still comes out with line breaks in.
Normally this wouldn't matter with HTML but in this specific case it is
making a difference to the way IE renders the page.

however, the <xsl:text> did provide a workaround. I replaced <br> with

<xsl:text>&lt;br&gt;</xsl:text>

and now the extra whitespace is gone. It seems like an ultra-bodge but there
are only a couple of places I need to use it so I'll have to be pragmatic
about it.

Thanks

Andy



> --
>
> Patrick TJ McPhee
> East York Canada
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Splitting text at whitespace but keeping the whitespace in thereturned list MRAB Python 3 01-26-2010 11:36 PM
Structure using whitespace vs logical whitespace cmdrrickhunter@yaho.com Python 10 12-16-2008 03:51 PM
Controlling whitespace in XSL output - tutorial anywhere? Simon Brooke XML 6 10-24-2007 01:06 PM
XSL: Whitespace Problem With HTML Output josh.asbury@gmail.com XML 2 01-31-2005 04:29 PM
Whitespace where I don't want whitespace! Oli Filth HTML 9 01-17-2005 08:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57