Re: [xsl] question on line breaks / chess

Subject: Re: [xsl] question on line breaks / chess
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 17 Jul 2009 13:34:02 +0200
Hermann Stamm-Wilbrandt wrote:

The display of board.xml is not nice because of additional vertical
spacing, but running "xsltproc board.xsl board.xml >board.html" and
viewing board.html all is fine:
http://www.stamm-wilbrandt.de/en/xsl-list/chess/board.xml
http://www.stamm-wilbrandt.de/en/xsl-list/chess/board.html


Now I have three questions: 1) How can I inspect the output of the transformation in the browser? "View source" does not help since it shows the XML input.

With Firefox you should be able to use Firebug to see the DOM tree of the transformation result. You should also be able to select the complete contents of the browser window with select all (ctrl-a) and use the context menu (right click) and "view selection source".


With IE 8 you should also be able to use developer tools (F12) to inspect the DOM tree of the transformation result.

With other browsers there might be similar options or you could try a JavaScript bookmarklet that does
javascript:alert(document.documentElement.outerHTML)


2) How can I make the output of the browser transformation similar to
   that of xsltproc?

   board.html looks like this, all in a single line (split into many
   lines here for readybility, only):
   <html><table border="1"><tr><td><img src="gif/brw.gif"><img src="gif/
   bnb.gif"><img src="gif/bbw.gif"><img src="gif/bqb.gif"><img src="gif/
   bkw.gif"><img src="gif/bbb.gif"><img src="gif/bnw.gif"><img src="gif/
   brb.gif"><br><img src="gif/bpb.gif">...
   ...<img src="gif/wrw.gif"><br></td></tr></table></html>

I think with IE the transformation result looks as you want is, the same as the static HTML document you have.


With Firefox https://developer.mozilla.org/en/Images,_Tables,_and_Mysterious_Gaps explains why you get the gaps. The problem is that Firefox always displays the result of an XSLT transformation in strict mode (also called standards mode) so the doctype sniffing that happens for static text/html documents does not happen for XSLT result documents. That way your transformation result in Firefox is rendered in strict mode and has those gaps. That way some of the workarounds like triggering quirks mode or almost standards mode are not possible. I think you will need to change the table you have and put each img into a td cell of its own, probably together with a CSS rule
td img { display: block; }



--


	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread