Jump to content

XML - Managing Data Exchange/XPath/Exercises

From Wikibooks, open books for an open world

XPath Chapter => XPath

XPath Answers => Answers


Below are exercises you can do to hone in on your XPath skills. Use the tree.xml file and xsl-tree.xsl to do the following:

XPath Tree Example

[edit | edit source]

Modify and copy the xsl-tree.xsl file and rename the copies, indicating the question number.

  1. Print the name attribute of every bigBranch element with thickness set as ‘thick’.
  2. Print the name of the parent of each bigBranch.
  3. Print the color of all leaves with a color attribute.

XPath Chapter => XPath

XPath Answers => Answers