Re: [xsl] XSLT: question re testing for possibly empty elements

Subject: Re: [xsl] XSLT: question re testing for possibly empty elements
From: Ralph Holz <ralph.holz@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 17 Aug 2004 11:17:35 +0200
Hi,

Consider <foo> </foo> and <foo/>

"string-length(anElement) > 0" will return true for the first one,
"normalize-space()" will return false for both.

True!


I guess what the original author really meant was to check if the element is "empty or non-white" - because the data stored in anElement would be a car's license number and it makes no sense to return spaces (which are invisible on the print-out) when there's alternative data stored (which he retrieves in the otherwise-branch).

I reckon my test with normalize-space() is more accurate.

Thanks,
Ralph

Current Thread