W3C XPath exercises
On the following pages we have put together XPath exercises for you. You will constantly encounter problems or constellations of this kind in your daily development work with onion.net.
The tasks involve creating the desired result on an XML document by means of an XPath expression. The result can either be a text (e.g. the value of an attribute or the number of certain elements) or even an XML. All information you will need for the solution is provided in the exercise.
The degree of difficulty of the tasks increases towards the end. Still, you can of course begin with a task of your choice or simply click your way through the exercises one by one.
You will find an introduction to XPath on the pages of w3schools.com.
We wish you good luck with the exercises and hope you enjoy doing them!
Availabel tasks
- Attribut selection
- Conditional element selection
- Merging character strings
- Filtering by attribute value
- Filtering by numeric values
- Limiting number
- Filtering by character conditions
- Filtering by text length
- Rounding up and down and adding
- Selecting the following siblings
- Selecting following siblings with filtering
- Attribute selection with namespaces
- Selecting all links of a document
- Selecting all links to Google within a document
- Selecting elements by name
- Selecting elements by name with namespaces
- Counting elements selected by certain criteria
- Content of a parent element
- Finding surrounding element
- First and last element
- Changing character string
- Counting nodes with condition
- Comparisons in conditions
- Selecting all links which open a new window
- Calculating position
- Changing small to capital letters
- Selecting querystring
- Elements with mixed text
- Filtering by key and numerical value
- Totalling by key and numerical value
- Selecting subelements by number
- Selecting elements by namespace
- Change XML document into CSV output