xsl-list
[Top] [All Lists]

RE: count() problem

2004-04-17 11:09:43
-----Original Message-----
From: Sam Saha [mailto:sam_saha1975(_at_)yahoo(_dot_)ca]

Hi,


<snip />
  How do I use the count() function to count the
number of nodes that do NOT have a blank value. I have
the following xml. In this case the count should be 6.
<snip />

I am doing something like this:
<xsl:variable name="num"
select="count(root/nodes/*[starts-with(local-name(),'tele')!=''
or starts-with(local-name(),'node')!=''])" />


Hmm, this makes little sense, as you are counting nodes for which the
following expression:

starts-with(local-name(),'tele')

is not equal to ''

This will indeed be true also for the blank nodes, so you probably need
something like:

count(root/nodes/*[(starts-with(local-name(),'tele') or
                    starts-with(local-name(),'node'))
                    and not(.='')])


Hope this helps!

Cheers,

Andreas



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