XSLT White Space Gaps Under Images

Discussion in 'XML' started by Mark247, Sep 2, 2004.

  1. Mark247

    Mark247 Guest

    Hi,
    When transforming an XSLT to HTML I get a very annnoying white spac
    gap of about 2px under each image. This is particularly annoying as
    am creating a vertical navigation menu made up of images wit
    rollovers. I know why the space is there, I just dont know how t
    remedy the problem in my XSLT. The space is caused by the transforme
    HTML closing </a> being on the next line from the closing </img> ta
    and the closing </td> on the next line again. Even if I line everythin
    up on the same line in the source XSLT it jumps down again when it i
    transformed to HTML.

    The XSLT code is pretty simple:

    <td><a>
    <xsl:attribute name="href">
    <xsl:value-of select="$VirPath" />default.aspx
    </xsl:attribute>
    <img name="ImageName" src="Image.gif>
    </img></a></td>

    How can I force the transformed HTML to line up properly so I dont ge
    this 2px gap under my images


    -
    Mark24
    -----------------------------------------------------------------------
    Posted via http://www.forum4designers.co
    -----------------------------------------------------------------------
    View this thread: http://www.forum4designers.com/message115162.htm
    Mark247, Sep 2, 2004
    #1
    1. Advertising

  2. Mark247

    Marrow Guest

    Hi Mark,

    To take tight control of the whitespace produced by your transformation...
    1. Make sure your output method is HTML and turn indentation off, e.g.
    <xsl:eek:utput method="html" indent="no"/>

    2. Ensure that all implicit output text is made explicit - implicit output
    text being text that is not wrapped within <xsl:text>, e.g.
    convert things like...
    <p>Something</p>
    to...
    <p>
    <xsl:text>Something</xsl:text>
    </p>

    Also, don't use <xsl:attribute> when an AVT (attribute value template) would
    suffice, e.g. rather than...
    <td>
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="$VirPath" />default.aspx
    </xsl:attribute>
    <img name="ImageName" src="Image.gif></img>
    </a>
    </td>
    use instead...
    <td>
    <a href="{$VirPath}default.aspx">
    <img name="ImageName" src="Image.gif"/>
    </a>
    </td>


    HTH
    Marrow
    http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
    http://www.topxml.com/Xselerator


    "Mark247" <4designers.com> wrote in message
    news:4designers.com...
    >
    > Hi,
    > When transforming an XSLT to HTML I get a very annnoying white space
    > gap of about 2px under each image. This is particularly annoying as I
    > am creating a vertical navigation menu made up of images with
    > rollovers. I know why the space is there, I just dont know how to
    > remedy the problem in my XSLT. The space is caused by the transformed
    > HTML closing </a> being on the next line from the closing </img> tag
    > and the closing </td> on the next line again. Even if I line everything
    > up on the same line in the source XSLT it jumps down again when it is
    > transformed to HTML.
    >
    > The XSLT code is pretty simple:
    >
    > <td><a>
    > <xsl:attribute name="href">
    > <xsl:value-of select="$VirPath" />default.aspx
    > </xsl:attribute>
    > <img name="ImageName" src="Image.gif>
    > </img></a></td>
    >
    > How can I force the transformed HTML to line up properly so I dont get
    > this 2px gap under my images?
    >
    >
    >
    > --
    > Mark247
    > ------------------------------------------------------------------------
    > Posted via http://www.forum4designers.com
    > ------------------------------------------------------------------------
    > View this thread: http://www.forum4designers.com/message115162.html
    >
    Marrow, Sep 3, 2004
    #2
    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. joeblack
    Replies:
    3
    Views:
    516
    joeblack
    Nov 4, 2003
  2. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,863
    Bryan Bullard
    Jul 11, 2003
  3. Christian Seberino
    Replies:
    21
    Views:
    1,621
    Stephen Horne
    Oct 27, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    978
    Steve Lamb
    Oct 23, 2003
  5. Ben C
    Replies:
    6
    Views:
    2,131
    Leif K-Brooks
    Jan 28, 2007
Loading...

Share This Page