Janis Voigtl¨ ander
Technische Universit¨at Dresden
Summer Term 2009
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Document:
A
B B
C D
D
E
E F
F F
F
F F
Query: /descendant::D/child::F[position()=1]
Paths: /descendant::D/child::F[position()=1]
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
child::F[position()=1]
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
child::F[position()=1]
Axes: descendant, child, . . .
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
child::F[position()=1]
Axes: descendant, child, . . .
Tests: D, F, . . .
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
child::F[position()=1]
Axes: descendant, child, . . . Tests: D, F, . . .
Filters: position()=1, . . .
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
child::F[position()=1]
Axes: descendant, child, . . . Tests: D, F, . . .
Filters: position()=1, . . .
General syntax:
path ::= step/ · · · /step | /step/ · · · /step
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
child::F[position()=1]
Axes: descendant, child, . . . Tests: D, F, . . .
Filters: position()=1, . . .
General syntax:
path ::= step/ · · · /step | /step/ · · · /step
step ::= axis :: test[fexp] · · · [fexp]
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
child::F[position()=1]
Axes: descendant, child, . . . Tests: D, F, . . .
Filters: position()=1, . . .
General syntax:
path ::= step/ · · · /step | /step/ · · · /step step ::= axis :: test[fexp] · · · [fexp]
test ::= name | node() | text() | · · ·
Paths: /descendant::D/child::F[position()=1]
Steps: descendant::D
child::F[position()=1]
Axes: descendant, child, . . . Tests: D, F, . . .
Filters: position()=1, . . .
General syntax:
path ::= step/ · · · /step | /step/ · · · /step step ::= axis :: test[fexp] · · · [fexp]
test ::= name | node() | text() | · · ·
fexp ::= · · ·
child
descendant
descendant-or-self
parent
ancestor
ancestor-or-self
following-sibling
following
preceding-sibling
preceding
self
attribute
/descendant-or-self::node()/ → //
/descendant-or-self::node()/ → //
self::node() → .
/descendant-or-self::node()/ → //
self::node() → .
parent::node() → ..
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: →
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: →
attribute:: → @
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. .
.
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. . .
Thus, for example:
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
→
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. . .
Thus, for example:
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
→
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. . .
Thus, for example:
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
→
//child::box/child::item[attribute::color="yellow"]
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. . .
Thus, for example:
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
→
//child::box/child::item[attribute::color="yellow"]
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. . .
Thus, for example:
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
→
//box/item[attribute::color="yellow"]
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. . .
Thus, for example:
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
→
//box/item[attribute::color="yellow"]
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. . .
Thus, for example:
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
→
//box/item[@color="yellow"]
/descendant-or-self::node()/ → //
self::node() → . parent::node() → ..
child:: → attribute:: → @ position()= n → n
. . .
Thus, for example:
/descendant-or-self::node()/child::box/
child::item[attribute::color="yellow"]
→
//box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box/item[@color="yellow"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item]
Note the difference to //box/item !
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item[@color="yellow"]]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item[@color="yellow"]]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item[@color="yellow"]]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item[@color="yellow"]]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item[@color="yellow"]]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item[@color="yellow"]]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //box[item[@color="yellow"]]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: /descendant::item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: /descendant::item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: /descendant::item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: /descendant::item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: /descendant::item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: /descendant::item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: /descendant::item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1]
Note the difference to /descendant::item[1] !
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[1][@color="blue"]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”
Query: //item[@color="blue"][1]
Document:
doc box
box
box
item
item
item
item
item color=“blue”
color=“green”
color=“yellow”
color=“blue”
color=“yellow”