Missing borders on an empty cell

Here should go questions about transforming XML with XSLT and FOP.
Posts: 1
Joined: Wed Nov 04, 2015 6:31 pm

Missing borders on an empty cell

Post by ajtruckle » Wed Nov 04, 2015 6:35 pm

Code: Select all

<td class="borderDotName">
<xsl:value-of select="Label1"/>
If the "Label1" value in the XML is not empty then the cell looks OK in the browser. But if it is empty and have no text, then the borders of my cell are missing. How can I handle empty cells?



Posts: 7150
Joined: Fri Jul 09, 2004 5:18 pm

Re: Missing borders on an empty cell

Post by Radu » Thu Nov 05, 2015 12:34 pm

Hi Andrew,

It probably depends on how the final HTML content looks like in the case of the missing value.
If the final HTML has the table cell looking like this: <td/> web browsers might have problems with it.
Ideally you could set <xsl:output method="html"/> in your XSLT stylesheet or add an XML comment inside the XSLT like:

Code: Select all

                <td class="borderDotName">
<xsl:when test="$Label1">
<xsl:value-of select="$Label1"/>
<xsl:comment>Empty CEll</xsl:comment>
to avoid having in the final HTML the <td> serialized in the short <td/> form.

More about this here:


Radu Coravu
<oXygen/> XML Editor

Post Reply