[xsl] XSLT Streaming Terminology: Roaming

Subject: [xsl] XSLT Streaming Terminology: Roaming
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Sat, 15 Feb 2014 10:33:42 +0000
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

Current Thread