02b: XPATH Practice Flashcards

1
Q

Expression:

All title elements that are grandchildren of bookstore elements

A

bookstore/*/title

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Expression:

All book elements with style attributes of the current context

A

book[@style]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Expression:

The style attribute for all book elements of the current context

A

book/@style

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Expression:

All attributes of the current element context

A

@*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Expression:

All first-name elements in the current context node

A

./first-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Expression:

The third author element that has a first-name child

A

author[first-name][3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Expression:

All author elements that contain at least one degree element child and at least one award element child

A

author[degree and award]​

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Expression:

All author elements that contain at least one degree or award and at least one publication as the children

A

author[(degree or award) and publication]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Expression:

All author elements where the first last-name child element has the value “Bob”

A

author[last-name[1] = “Bob”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Expression:

The author elements whose value is “Matthew Bob”

A

author[. = “Matthew Bob”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Expression:

All author elements that contain a last-name child element whose value is “Bob”, and a price sibling element whose value is greater than 50

A

author[last-name = “Bob” and ../price > 50]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Expression:

All author elements containing any child element whose value is “Bob”

A

author[* = “Bob”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Expression:

All author elements that has a last-name child element with the value “Bob” and a first-name child element with the value “Joe”

A

author[last-name = “Bob” and first-name = “Joe”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Expression:

The nearest book ancestor of the context node

A

ancestor::book[1]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Expression:

Select all author elements that contain a first-name child element whose value is “Alex” and a price sibling element whose value is less than 20

A

author[first-name = “Alex” and ../price < 20]​

How well did you know this?
1
Not at all
2
3
4
5
Perfectly