RE: [xsl] test for blank

Subject: RE: [xsl] test for blank
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Wed, 20 Nov 2002 14:18:16 -0700
> From: SAL ROSALES Jr. [mailto:salrosales@xxxxxxxxxxx]
> Sent: Wednesday, November 20, 2002 2:03 PM
> Subject: [xsl] test for blank
> 
> 
> I'm trying to test for a value of nothing for with
> XSL. I understand there are no 'else' statements
> available in xsl so I'm trying to get this to work. I
> thought using the not function would work but so far
> the only output I'm getting is from the 1st nested if
> statement
> 
> Here are my if statements:
> 
> <xsl:if test="@value">
> 						<xsl:if 
> test="@value[contains(., '')]">
> 							There 
> is nothing to see
> 							</xsl:if>
> 						<xsl:if 
> test="@value[not(contains(., ''))]">
> 							
> <xsl:value-of select="."/>
> 							
> </xsl:if>							
> 			
> 						</xsl:if>


contains(., '') will *always* return true, so this is a useless test.  Why
not just do:

<xsl:if test="@value = ''"> for the first test, and
<xsl:if test="@value != ''"> for the second?  Or use xsl:choose:

<xsl:choose>
  <xsl:when test="@value = ''"> etc.

hth,
b.

| brian martinez                              brian.martinez@xxxxxxxx |
| senior gui programmer                                  303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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


Current Thread