xsl-list
[Top] [All Lists]

[xsl] XSLT Streaming Terminology: Roaming

2014-02-15 04:34:00
Hi Folks,

The XSLT 3.0 specification defines roaming like so:

        Roaming: indicates that the nodes returned 
        by an expression could be anywhere in the 
        tree. For example, expressions using the axis 
        steps following or preceding will typically be 
        roaming.

Suppose I create a function. I pass to it the context node and it returns some 
nodes: 

<xsl:function name="f:get-nodes" as="element()*">
    <xsl:param name="context-node" />
    ...
</xsl:function>

The function is a black box; the nodes that it returns could be from anywhere 
in the XML document. So this expression:

        f:get-nodes(.)

is roaming.

Next, suppose the XSLT processor is positioned at the first <title> element:

Document>
    <title>A</title>
    <section>
        <title>B</title>
        <section>
            <title>C</title>
        </section>
    </section>
</Document>

This expression:

        following::section

returns all <section> elements that follow the <title> element. 

Apparently that expression is roaming. But I don't see why. 

Roaming means that the expression could returns nodes from "anywhere in the 
tree." Clearly this expression: 

        following::section

is not returning nodes from "anywhere in the tree." Rather, it is returning 
nodes from a well-defined location in the tree. 

I understand how f:get-nodes(.) could return nodes from anywhere in the tree, 
but I don't see how following::section could return nodes from anywhere in the 
tree. Would you shed light on this please?

/Roger



--~------------------------------------------------------------------
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>