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

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

The
@
Abbreviation

When the
@
sign appears in front of a
NodeTest
, it indicates that you are selecting nodes using the attribute axis. It is short for
attribute::
.

What this means in practice is that in a path expression
A/@B
,
B
is referring to an attribute of
A
, while in the path expression
A/B
,
B
is referring to a child element of
A
.

Again, this abbreviation is ubiquitous among XPath developers, and it's rare to see
attribute::
written out in full. In fact, the
@
in front of an attribute name has become so familiar that people often think of it as being almost part of the name. I'm probably not the only one who has found myself typing

in an XML document (which, of course, will be thrown out by an XML parser).

Other books

Romance Book Club by Hughes, Michelle
Stars Collide by Janice Thompson
Unknown by Mari Jungstedt
Billionaire Bad Boys of Romance Boxed Set (10 Book Bundle) by Kitt, Selena, Taylor, Tawny, Lore, Ava, Towers, Terry, Antonia, Anna, Aday, Amy, L'Amour, Nelle, Burke, Dez, Tee, Marian
What I Remember Most by Cathy Lamb
Labyrinths of Reason by William Poundstone
A Courted Affair by Jane Winston
Target: Tinos by Jeffrey Siger