xsl-list
[Top] [All Lists]

Re: [xsl] Streaming terminology: Grounded

2014-01-20 06:08:08

On 20 Jan 2014, at 10:38, Costello, Roger L. <costello(_at_)mitre(_dot_)org> 
wrote:

Hi Folks,

I am having a hard time understanding the new streaming terminology. And, 
truthfully, I am feeling overwhelmed with all the new terminology.

Yes, it is overwhelming. Believe me, we put it in place because we found we 
were using the same words to mean different things at different times and were 
getting ourselves very confused as a result.

Perhaps we could collectively discuss each term, one at a time, and 
understand them?

How about starting with "grounded".

The spec defines it this way:

       Grounded: indicates that the value returned 
      by the construct does not contain nodes from 
      the streamed input document. Atomic values 
      and function items are always grounded; nodes 
      are grounded if it is known that the they are in 
      a non-streamed document. For example the 
      expressions doc('x') and copy-of(.) both return 
      grounded nodes.

So this string

      "Hello World"

is grounded because it is an atomic value and clearly it doesn't involve 
reading anything from the input. That seems reasonable to me.

Correct.

I am puzzled why 

      copy-of(.) 

is grounded, as it surely *does* result in reading (consuming) the input, 
right?

It's sweep is consuming, because it consumes the input. But its posture is 
grounded, because the node it returns is a non-streamed node; it's an ordinary 
in-memory tree, which means you can do any navigation you like on the result, 
with no restrictions imposed by the streaming rules.

And why is

      doc('Book.xml')

grounded? Surely that expression results in reading new input (i.e., the 
content of Book.xml), right?

It's what it returns that counts. We've defined that doc() returns an ordinary 
in-memory tree, allowing free navigation in any direction with no streaming 
restrictions.

What are other examples of things that you might put in an XSLT program that 
doesn't result in consuming any input?

So, grounded means "anything that doesn't result in consuming input", right?

No. That was one of the key mistakes we were making before we introduced this 
terminology. Grounded expressions can be consuming, and non-grounded 
expressions can be non-consuming. They are orthogonal concepts. One is about 
the input to the expression, one is about its output.

Michael Kay
Saxonica




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


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