This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How can I test 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@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Xu, Xiaocun
Sent: Tuesday, March 20, 2001 2:03 PM
To: 'xsl-list@lists.mulberrytech.com'
Subject: RE: [xsl] 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@emptoris.com

> -----Original Message-----
> From: Denis Kranjcec [mailto:denis.kranjcec@zpm.fer.hr]
> Sent: Tuesday, March 20, 2001 6:10 AM
> To: Xsl-List
> Subject: [xsl] 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]