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

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

To see the difference, consider the following source document:


   


      

      

   


   

   


      

      

   



With this document, if the variable
$chapters
contains only the outer

element,
$chapters//diagram[1]
will select diagrams 12, 14, and 15, while both
$chapters/descendant::diagram[1]
and
($chapters//diagram)[1]
will select diagram 12 only.

Combining Sets of Nodes

Until now this chapter has been all about path expressions. This section describes operators that combine two sets of nodes. Although these aren't technically path expressions, they are invariably used in conjunction with path expressions, so it's useful to deal with them at the same time. The operators are:

  • Union, written
    union
    or
    |
    , which includes a node in the result if it is present in either of the two supplied sets, eliminating any duplicates.
  • Intersection, written
    intersect
    , which includes a node in the result if it is in both the two sets.
  • Difference, written
    except
    , which includes a node in the result if it is in the first set and is not in the second.
BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
13.96Mb size Format: txt, pdf, ePub
ads

Other books

The Blitz by Vince Cross
Captive Girl by Jennifer Pelland
The Sirena Quest by Michael A. Kahn
Facing the Music by Larry Brown
Say When by Elizabeth Berg
The Rodriguez Affair (1970) by Pattinson, James
Brown, Dale - Independent 02 by Hammerheads (v1.1)
Archangel by Kathryn Le Veque