Page 1 of 1

Missing borders on an empty cell

Posted: Wed Nov 04, 2015 6:35 pm
by ajtruckle

Code: Select all

<td class="borderDotName">
<xsl:value-of select="Label1"/>
</td>
Hi
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?

Thanks.

Andrew

Re: Missing borders on an empty cell

Posted: Thu Nov 05, 2015 12:34 pm
by Radu
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:choose>
<xsl:when test="$Label1">
<xsl:value-of select="$Label1"/>
</xsl:when>
<xsl:otherwise>
<xsl:comment>Empty CEll</xsl:comment>
</xsl:otherwise>
</xsl:choose>
</td>
to avoid having in the final HTML the <td> serialized in the short <td/> form.

More about this here:

http://www.w3.org/TR/xhtml1/guidelines.html

Regards,
Radu