Skip to content Skip to navigation

OpenStax-CNX

You are here: Home » Content » XPath

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

In these lenses

  • XSLT display tagshide tags

    This module is included inLens: Hannes Hirzel's XSLT Lens
    By: Hannes Hirzel

    Comments:

    "XPath is a small language to access XML documents."

    Click the "XSLT" link to see all content selected in this lens.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

XPath

Module by: Hannes Hirzel. E-mail the author

Summary: XPath (XML Path Language) is a query language for selecting nodes from an XML document.

Note: You are viewing an old version of this document. The latest version is available here.

XPath

XPath (for XML Path Language) is a query language for selecting a node or a nodeset from an XML document. XPath expressions are used in XSLT style sheets.

XPath tutorial

http://www.w3schools.com/xpath/

Jennifer Widom of the Stanford School of Engineering has video lectures with an XPath introduction and demo. There are more lectures about related technologies.

W3C recommendation

http://www.w3.org/TR/xpath20/, in particular http://www.w3.org/TR/xpath20/#id-path-expressions.

XQuery versus XPath

XQuery extends XPath. The Kernow GUI allows to test XQuery and thus XPath expressions.

Notes

// is an abbreviation for /descendant-or-self::node()/. Thus with the expression //elementName you will find any element named elementName in the whole document tree.

The XPath expression lexical-unit/form[&lang='en'] selects form subnodes of lexical-units elements which have an attribute lang with the value of en.

Content actions

Download module as:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks