[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How can I test if element is empty?

Subject: RE: How can I test if element is empty?
From: "Denis Kranjcec" <denis.kranjcec@xxxxxxxxxx>
Date: Tue, 20 Mar 2001 15:00:31 +0100
xsl if element is empty
I tried that and my test is always true

xsl
<xsl:when test="string(elem) != string('')">

xml
<elem/>

I'm using xalan, is it problem with xalan? (I don't think so)

Denis Kranjcec

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Xu, Xiaocun
Sent: Tuesday, March 20, 2001 2:03 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE:  How can I test if element is empty? 


One way to do it is:
<xsl:when test="string(elem) == string('')">
Note: the quotes inside the second string() is two single quotes

Xiaocun Xu
Emptoris, Inc.
xxu@xxxxxxxxxxxx

> -----Original Message-----
> From: Denis Kranjcec [mailto:denis.kranjcec@xxxxxxxxxx]
> Sent: Tuesday, March 20, 2001 6:10 AM
> To: Xsl-List
> Subject:  How can I test if element is empty? 
> 
> 
> Hi
> 
> So,how can I test if element is empty with xsl?
> 
> example element
> <elem/> or <elem></elem>
> 
> I have tried this
> <xsl:choose>
> 	<xsl:when test="string-length(elem)">
> 		<xsl:value-of select="elem"/>
> 	</xsl:when>				
> 	<xsl:otherwise>
> 		<xsl:value-of select="NOelem"/>
> 	</xsl:otherwise>
> </xsl:choose>
> 
> and this
> <xsl:when test="elem == ''">
> 
> but that don't work
> 
> Thanks in advance
> Denis Kranjcec
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

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



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.