RE: [xsl] count() problem

Subject: RE: [xsl] count() problem
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sat, 17 Apr 2004 20:09:43 +0200
> -----Original Message-----
> From: Sam Saha [mailto:sam_saha1975@xxxxxxxx]

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

Current Thread