[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Does the count() function require access to the whole subtree?

Subject: Re: [xsl] Does the count() function require access to the whole subtree?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 12 Jan 2014 09:00:01 -0800

On Sun, Jan 12, 2014 at 5:27 AM, David Carlisle <davidc@xxxxxxxxx> wrote:
> I think the way to think of it is to see that given a sequence of nodes
> $seq then count($seq) doesn't require you to access anything that you
> haven't already accessed (even if you are in a streaming context and
> some of the nodes are still being streamed)

If the context node has N children nodes, it isn't possible to know
that there are K children, unless at least these K children nodes (and
their sub-trees) are already read (confirmed to exist).

So, to test the existence of


one will need to confirm this by reading through at least K children nodes.

Even worse, to test the existence of:


one may need to read *all* the children of the context node.

These observations show, that  in general "count()" , using the chosen
terminology, is clearly an "absorption" operation and not an
"inspection" operation, though there is one exception when count() is
applied on nodes, whose number is statically known -- such as:




Of course, it is meaningless to use the above three expressions,
because we already know what they would exactly produce ...

Dimitre Novatchev
Truly great madness cannot be achieved without significant intelligence.
To invent, you need a good imagination and a pile of junk
Never fight an inanimate object
To avoid situations in which you might make mistakes may be the
biggest mistake of all
Quality means doing it right when no one is looking.
You've achieved success in your field when you don't know whether what
you're doing is work or play
To achieve the impossible dream, try going to sleep.
Facts do not cease to exist because they are ignored.
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
I finally figured out the only reason to be alive is to enjoy it.

Current Thread