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

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

Note that a
NameTest
cannot contain embedded whitespace.

Usage

In general, a
NameTest
will match some names and will not match others.

The
NameTest
*
matches any name. (But when used as an expression on its own,
*
is short for
child::*
, which selects all child elements of the context node. The fact that the result is restricted to element nodes only is because
*
, when used in an
AxisStep
, selects only nodes of the principal node kind for the axis, and for all axes except the attribute and namespace axes, the principal node kind is element nodes.)

A surprising effect of this rule is that you can't write:


to copy all attributes of an element except the title attribute. Why? Because the principal node kind for the self axis is element nodes, so if the context node is an attribute named title,
self::title
won't select it. Instead, write:


The
NameTest
xyz:*
matches any name whose namespace is the one currently bound to the namespace prefix
xyz
. The name being tested doesn't need to use the same prefix, so long as it refers to the same namespace URI.

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

Other books

The Saint to the Rescue by Leslie Charteris
Wicked Wyoming Nights by Greenwood, Leigh
Getting Caught by Mandy Hubbard
Blitz by Claire Rayner
The Dead Emcee Scrolls by Saul Williams
His Dark Embrace by Amanda Ashley
Loss of Innocence by Richard North Patterson