homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

XSLT White Space Gaps Under Images
XSLT White Space Gaps Under Images

 8:56 pm on Sep 2, 2004 (gmt 0)

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 (simplified) XSLT code is pretty simple:

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

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



 3:06 pm on Sep 3, 2004 (gmt 0)

Which xslt processor are you using?


 3:30 pm on Sep 3, 2004 (gmt 0)

Check your <xml:output> statement. If your output method is "xml" or "html," and you have indent="yes", processors will output the tree as an indented hierarchy, each tag on its own line. The default is supposed to be indent="no".

More fundamentally, why are you including a closing tag for <img>, an empty element? Browsers' methods of handling or ignoring an invalid HTML tag are outside the domain of XSLT.


 12:30 am on Sep 4, 2004 (gmt 0)

In xsl, you do have to close empty elements also, otherwise the transformation will fail as the processor will burp over it.

I'm not sure about the 2px gap, try the indet if you are doing xml output.


 8:48 pm on Sep 5, 2004 (gmt 0)

The indent="no" works just fine, problem solved.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved