XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (402 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
8.54Mb size Format: txt, pdf, ePub
ads

as an
AxisStep
means
child::node()
and therefore selects only children of the context node. If you want to select attributes as well, write
@*|node()
.

If you want to select all elements, you can use the
KindTest
element()
, and if you want to select all attributes, you can use
attribute()
. However, it is more usual in these cases simply to use the
NodeTest
*
. Specifying
*
selects the nodes of the principal node kind for the selected axis, which will always be elements in the case of an axis that can contain elements, and attributes in the case of an axis that can contain attributes. The
KindTests
element()
and
attribute()
are generally used with parameters that specify the schema-defined type of the required elements or attributes, as described in Chapter 11.

Similarly, the
KindTest
document-node()
can be used without parameters to select all document nodes. But you won't see this used much in practice, because the document node can be selected using the simpler syntax
/
, discussed later in this chapter on page 623. With parameters, the
document-node()
KindTest
can be used to test for the document node containing an element of a particular schema-defined type—again, this is described in Chapter 11.

There is no specific
KindTest for
namespace nodes. But all the nodes on the namespace axis are namespace nodes, so the expressions
namespace::*
and
namespace::node()
both work fine, provided that your implementation supports use of the namespace axis.

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
8.54Mb size Format: txt, pdf, ePub
ads

Other books

Remaindered by Peter Lovesey
Red Blooded by Caitlin Sinead
The Boat in the Evening by Tarjei Vesaas
Devonshire Scream by Laura Childs
The Break-Up Psychic by Emily Hemmer