xsl-list
[Top] [All Lists]

RE: Logical in Count function

2004-08-18 09:47:00
From: Tham Tinh [mailto:khautinh(_at_)yahoo(_dot_)com]

I still have anohter question how to use logical and,
or in Count function.  I wrote
<p>Employee Count: <xsl:value-of
select="count(/dsWMSRpt/WMSReport[Person_x0020_Name!='Vacancy']
and /dsWMSRpt/WMSReport[Person_x0020_Name!=''])"/></p>

and I got an error.  Am I wrong to use logical and in
it?  Please correct for me.

You just have your "and" operator in the wrong place.  You cannot use
"and" or "or" in a path expression, but that would not be what you want
here anyway.  Instead, you probably want 

count(/dsWMSRpt/WMSReport[Person_x0020_Name!='Vacancy' and
Person_x0020_Name!='']

You might want to use normalize-space(Person_x0020_Name)

(without the !='', which wouldn't be necessary), in case a name element
happens to contain only whitespace.

Cheers,

Tom P


<Prev in Thread] Current Thread [Next in Thread>