Possible whitespace problem with XT ?

Subject: Possible whitespace problem with XT ?
From: "Alistair MacDonald" <AlistairMacDonald@xxxxxxxxxxxxx>
Date: Tue, 27 Jul 1999 15:58:02 +0100
I can't decide it this is a problem with my interpretation of the spec, or something with XT.

I've got a problem cause by the way that both IE & Netscape interpret spaces in their input -- if they see spaces at certain points in their input they will make gaps larger. Whilst this particular example shows a problem with Netscape, I *could* have demonstrated a problem with IE - its just not quite to simple to show.

Take this stylesheet:
-----
<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";
  xmlns="http://www.w3.org/TR/REC-html40";
  result-ns=""
  indent-result="no"
>

<xsl:template match="/doc">
<table>
<xsl:for-each select="item">
<tr><td>*</td><td><xsl:value-of select="text()"/></td></tr>
<tr><td colspan="2" width="1" height="4"><spacer type="block" width="1" height="4"/></td></tr>
</xsl:for-each>
</table>
</xsl:template>

</xsl:stylesheet>
-----

and this input file:
-----
<doc>
<item>foo</item>
<item>bar</item>
</doc>
-----

The output is simple:
-----
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<table>
<tr>
<td>*</td>
<td>foo</td>
</tr>
<tr>
<td colspan="2" width="1" height="4">
<spacer type="block" width="1" height="4"></spacer>
</td>
</tr>
<tr>
<td>*</td>
<td>bar</td>
</tr>
<tr>
<td colspan="2" width="1" height="4">
<spacer type="block" width="1" height="4"></spacer>
</td>
</tr>
</table>
-----

Note that XT has chosen to add whitespace (carriage returns) -- despite my instruction not to (in the stylesheet)

If you compare the results of loading this file into Netscape (I've tried some v4 & v5 versions) with the version below you will see a difference in the layout. Unfortunately, this causes a problem! Ignoring the browser layout issue, is the fact that the file above doesn't look the one below a problem with my understanding, or with XT's whitespace handling ?

-----
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<table>
<tr><td>*</td><td>foo</td></tr>
<tr><td colspan="2" width="1" height="4"><spacer type="block" width="1" height="4"></td></tr>
<tr><td>*</td><td>bar</td></tr>
<tr><td colspan="2" width="1" height="4"><spacer type="block" width="1" height="4"></td></tr>
</table>
-----

Alistair


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread