controlling whitespace with output method=html

Discussion in 'XML' started by Andy Fish, Jun 14, 2004.

  1. Andy Fish

    Andy Fish Guest

    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
     
    Andy Fish, Jun 14, 2004
    #1
    1. Advertising

  2. 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
     
    Patrick TJ McPhee, Jun 15, 2004
    #2
    1. Advertising

  3. Andy Fish

    Andy Fish Guest

    "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
    >
     
    Andy Fish, Jun 15, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oli Filth
    Replies:
    9
    Views:
    3,348
    Uncle Pirate
    Jan 17, 2005
  2. Replies:
    2
    Views:
    892
  3. Simon Brooke
    Replies:
    6
    Views:
    591
    Joseph Kesselman
    Oct 24, 2007
  4. Replies:
    10
    Views:
    769
    Eric Brunel
    Dec 16, 2008
  5. MRAB
    Replies:
    3
    Views:
    394
Loading...

Share This Page