XMP location path syntax

An XMP location path points to a specific node in an XMP node hierarchy (whether the node exists or not).

An XMP location path is a series of one or more XMP location steps separated by a slash. Each location step address the next child element, depending on the structure of the document.

Each location step is one of the following:


A language selector may occur only as the very last location step. The first location step is always a prefixed field name.

Field name

A field name addresses a named element (also called a field).

For example:

xmp:SomeProperty

Addresses a field named "SomeProperty" in the namespace to which the "xmp" namespace prefix is mapped.

Index selector

An index selector addresses an item in an array. Indices are one-based, that is, the first item in an array has index 1. The last item in an array can be addressed with the special index "last()". In all cases the index must be enclosed in square brackets and preceded by an asterisk.

For example:

*[1]

*[4]

*[last()]

Address the first, the fourth and the last item of an array, respectively.

Language selector

A language selector addresses an item in a collection with language alternatives (a collection of strings with the same meaning but localized for different human languages). The language is indicated by a 2-letter language code (ISO 639), optionally followed by a 2-letter country code (ISO 3166). The special language code "x-default" indicates the default language. The language code must be embedded in special XPath syntax for addressing the xml:lang attribute.

For example:

*[@xml:lang='enUS'] *[@xml:lang='x-default']

Address U.S. English and the default language item, respectively.

Examples

The following examples address properties in the XMP Dublin Core schema, which is usually associated with the "dc" prefix. Thus these examples assume that the "dc" prefix is mapped to the Dublin Core namespace URI (http://purl.org/dc/elements/1.1/).

Examples:

dc:format

Addresses the top-level data format property.

dc:creator/*[1]

Addresses the first item in the list of document creators, which by convention is the primary author of the document.

dc:description/*[@xml:lang='x-default']

Addresses the default item in the list of language alternatives for the document's description.