Missing borders on an empty cell

Here should go questions about transforming XML with XSLT and FOP.
Posts: 1

Missing borders on an empty cell

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: 5867

Re: Missing borders on an empty cell

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

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests