xsl-list
[Top] [All Lists]

Re: monotonous nbsp coding

2002-11-13 15:02:09
a bit shorter:

<td>
  <xsl:value-of select="."/>
  <xsl:if test=". = ''">&#160;</xsl:if>
</td>

and another one:

<td>
  <xsl:value-of select="concat(., '&#160;')"/>
</td>

Regards,

Joerg

Zakon, Stuart wrote:
Some older browsers have a problem rendering tables with empty <td> tags in
them. (You know which ones...)
Is there a better way to code this in XSLT than the following:

<td>
  <xsl:choose>
    <xsl:when test="string-length() &gt; 0"><xsl:value-of select="."
/></xsl:when>
    <xsl:otherwise>&nbsp;</xsl:otherwise>
  </xsl:choose>
</td>

This gets monotonous after a while.  It would be nice if <xsl:value-of>
could take an attribute which would provide a default value if the select
produces an empty result!

Stuart Zakon


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



<Prev in Thread] Current Thread [Next in Thread>