Name
[2.0] static-base-uri()
Returns the value of the base URI property from the
static context. The base URI property can change from one XML
element to the next, but static-base-uri()
returns the same
value regardless of the location in the input document. In Saxon-J
9.0.0.3, the static base URI is the base URI of the stylesheet.
Altova XML works similarly, although the format of the URI is not
exactly the same.
Syntax
xs:anyURI?static-base-uri(
)
Inputs
None.
Outputs
An xs:anyURI
that
represents the static base URI. If the base URI property is not
defined in the static context, static-base-uri()
returns the empty
sequence.
Defined in
XQuery 1.0 and XPath 2.0 Functions and Operators section 16, “Context Functions.”
Example
To illustrate how static-base-uri()
works, we’ll reuse
our earlier document that used the xml:base
attribute to define different
base URIs throughout the document:
<?xml version="1.0" encoding="utf-8"?> <!-- xmlbase.xml --> <cars> <manufacturer name="Chevrolet" xml:base="http://www.chevrolet.com/"> <car>Cavalier</car> <car>Corvette</car> <car>Impala</car> <car>Malibu</car> </manufacturer> <manufacturer name="Ford" xml:base="http://www.ford.com/"> <car>Pinto</car> <car>Mustang</car> <car>Taurus</car> </manufacturer> <manufacturer name="Volkswagen" xml:base="http://www.vw.com/"> <car>Beetle</car> <car>Jetta</car> <car>Passat</car> <car>Touraeg</car> </manufacturer> </cars>
Here’s our stylesheet. We call the static-base-uri()
function at the document root, and we also call ...
Get XSLT, 2nd Edition 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.