XQuery TutorialLesson 73Free preview
XQuery Select
This lesson is part of XML · All levels
Summary
Data selection in XQuery uses the full XPath path: / for root, // for derivative whatever its depth, and @ for attribute. Predicts in square brackets filter out nodes, for example [price>30] or [@category="web"]. Some lines can be combined with the union operator to get a combined sequence.
Key points
- //price selects the price element from any depth
- //book[@category] select books that have category attributes
- The predicate [1] takes the first node in the selection result
- The operator combines two sequences into one.
- Wildcard * selects all child elements, text() selects the text node
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.