Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
When a sequence constructor is evaluated, the result is, in general, a sequence of items. Many instructions such as
Most likely, the sequence returned by a sequence constructor will be used to build the content of an element node in the result tree. In the example shown in
Figure 2-9
:
Suppose that the template rule in our example is invoked using a construct such as the following:
The The This is by far the most common scenario: instructions are evaluated to produce a sequence of nodes, and the nodes are copied to form the contents of a result tree. However, in XSLT 2.0 it is also possible to process the sequence in other ways. In particular: This kind of variable is constructed when the
element, the final sequence delivered to the
element contains the results of expanding the template rule for each of the selected
element is a literal result element, which when evaluated constructs a new element node. The name of this node will be
, and the content will be formed from the sequence produced by evaluating the sequence constructor contained within the literal result element in the stylesheet. In our example, this sequence contains elements and text nodes, and these are copied to form the content of the new
element.
$months[3]
. But don't try doing
$months/month
; the
$months
variable holds a sequence of
$months/month
(which is short for
$months/child::month
) tries to find children of these elements that are named
as
attribute is present to define the required type of the items in the sequence. If the
as
attribute were omitted, the
$months
would refer to the document node of this tree. For more information, see the section “Temporary Documents” on page 85.Other books