Location Path Examples

You’ve seen a lot of location path theory, so how about some examples? The best way to learn this material is by example, so the following list includes a number of location path examples. (The abbreviated versions are next.)

  • child::PLANET. Returns the <PLANET> element children of the context node.

  • child::text(). Returns all text node children of the context node.

  • child::node(). Returns all the children of the context node.

  • attribute::UNIT. Returns the UNIT attribute of the context node.

  • descendant::PLANET. Returns the <PLANET> element descendants of the context node.

  • ancestor::PLANET. Returns all <PLANET> ancestors of the context node.

  • ancestor-or-self::PLANET. Returns the <PLANET> ancestors of the context node. If the context ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.