Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Using xsl:if with xsl:value-of

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 1/16/2008 3:29:00 PM

AlBruAn wrote:
> Thank you for suggesting a way of avoiding using CDATA and escaping the &.  
> My question is still this: how can I go about using data in the cell if any 
> is available or replacing it, as you've suggested, with the &#160 to ensure 
> the border is drawn around the cell?  As I mentioned in my original post, I 
> thought there might be a way of incorporating xsl:if along with xsl:value-of, 
> but I honestly don't know.

Use xsl:choose e.g. replace

<td><xsl:value-of select="ClaimNumber" /></td>

with

<td>
   <xsl:choose>
     <xsl:when test="normalize-space(ClaimNumber)">
       <xsl:value-of select="ClaimNumber"/>
     <xsl:when>
     <xsl:otherwise>&#160;</xsl:otherwise>
   </xsl:choose>
</td>

If you are using XSLT 2.0 then it is even easier
<td><xsl:value-of select="if (normalize-space(ClaimNumber)) then 
ClaimNumber else '&#160;'"/></td>

You should also investigate CSS 2 and the setting empty-cells: show. If 
your browser supports that (and Mozilla, Opera do) then you can avoid 
the above attempts and simply use CSS to ensure that empty cells are 
shown: <URL:http://www.w3.org/TR/CSS21/tables.html#empty-cells>


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent