Specifications

evaluates to the number of field elements in the document, regardless of their position in the
node tree
count(/doc/chapter[5]/section)
evaluates to the number of section elements in the fifth chapter element in the doc document
element
string-length(normalize-space(para))
evaluates to the number of characters in the text contents of the para element, after removing
leading and trailing white space and replacing sequences of white space characters by a single
space
Namespaces
The examples above assume that the XML document being queried does not use namespaces.
In practice however many XML documents do use namespaces to avoid conflicting element and
attribute names when information of a different type or origin is mixed.
A namespace is identified by a Unique Resource Identifier (URI) which resembles a web page
address but in fact is just a unique string (most URIs do not point to an actual web page). Rather
than repeating this URI each time, element and attribute names use a namespace prefix (a
shorthand) to refer to a namespace. The mapping between namespace prefixes and namespace
URIs is defined in namespace declarations in the XML file.
For example:
xml:lang
is the name of a standard xml attribute for indicating a natural language
jdf:node
is the name of a node element in the JDF specification, assuming that the jdf prefix is mapped
to the JDF namespace URI
Namespaces and XPath
If the XML file being queried uses namespaces, the XPath expressions and location paths must
use namespace prefixes as well. The mapping between those prefixes and the corresponding
namespace URIs must be passed to the query function separately, since this information can't
be expressed in XPath.
Note that namespace URIs must match between the XPath expression and the XML file; the
namespace prefixes may differ.
XPath does not have the concept of a default namespace. If the XML file being queried defines
a default namespace, the XPath expression must specify a namespace prefix to refer to elements
in that namespace. The default_switch_ns prefix can be used to specify elements using the
default namespace.
Introduction to Adobe XMP location paths
The Adobe XMP specification dated September 2005 defines the XMP data model (the abstract
node hierarchy represented by an XMP packet or file). Other Adobe publications define a
mechanism to address a specific node in the XMP data model, using a syntax that is a (very small)
subset of the XPath 1.0 location path syntax. In this documentation we refer to this mechanism
as XMP location paths.
330
Enfocus Switch 10