[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Re: Whitespace in Table Cells


Subject: [xsl] Re: Whitespace in Table Cells
From: "CHAUDHURI, Neil" <NCHAUDHURI@xxxxxxx>
Date: Mon, 28 Jul 2003 12:44:56 -0400

Well, Dion, after all the Java programming I have done, I have learned to be very sensitive to missing semicolons!  So yes, I have been trying to insert spaces into my table cells with &nbsp; and &#160;.  However, both of these entity references produce errors in Microsoft IE 6 for some reason.  I would love to figure out why this is, but in the meantime I would really like to know why utilizing <xsl:text> hasn't produced the desired result (though at least IE doesn't crash).

As for your request for some code, let me provide an abbreviated version:

Say we have a set of data ranging in number from 0-3 elements, and these are to be placed in a table.  The presence of fewer than three elements means all empty cells look the same but simply empty.  Here is the code I have been using to generate this.

<table cellspacing="0" cellpadding="0" width="100%" border="1">
	<tr>
	<!-- Call the following PART 1 -->
		<xsl:for-each select="RepeatableItem">								
			<xsl:apply-templates select=".">
				<xsl:with-param name="codeNumber" select="position()" /> 
				<!-- I am leaving out the template for brevity, but basically it just prints any existing data in table cells...nothing too fancy -->
			</xsl:apply-templates>
		</xsl:for-each>
					
		<!-- At this point, all of the 0-3 data items have been printed, so it is now time to print the empty cells (if necessary) for the remaining portion of the table
		     should there be fewer than the maximum 3 data items. -->
				
		<!-- Call the following PART 2 -->
	
		<xsl:choose>
			<xsl:when test="count(RepeatableItem) = 0">
				<td>
					<xsl:text>    </xsl:text>
				</td>
				<td>
					<xsl:text>    </xsl:text>
				</td>
				<td>
					<xsl:text>    </xsl:text>
				</td>
			</xsl:when>
			<xsl:when test="count(RepeatableItem) = 1">
				<td>
					<xsl:text>    </xsl:text>
				</td>
				<td>
					<xsl:text>    </xsl:text>
				</td>
			</xsl:when>
			<xsl:when test="count(RepeatableItem) = 2">
				<td>
					<xsl:text>    </xsl:text>
				</td>
			</xsl:when>
		</xsl:choose>									
	</tr>
</table>


As you can see, all that is going on here is a very rudimentary generation of empty cells to occupy the remainder of the table.  However, my problem is that the empy cells do not render at all.  It is as if none of the code in PART 2 even executes. 

Thanks again to all for any insights, and please let me know if you need any further explanation or clarification.

 
Neil
____________________________
Neil Chaudhuri
Research Fellow
Systems Development & Technology Support
Logistics Management Institute
(571) 633-7786
nchaudhuri@xxxxxxx
www.lmi.org


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



Current Thread