Example 1 |
Why XML Base?:
Standard excerpt:
"The XML Linking Language [XLink] defines Extensible
Markup Language (XML) 1.0 [XML] constructs to describe
links between resources. One of the stated requirements on XLink is to support HTML
[HTML 4.01] linking constructs in a generic way. The HTML BASE element is
one such construct which the XLink Working Group has considered. BASE allows authors
to explicitly specify a document's base URI for the purpose of resolving relative URIs
in links to external images, applets, form-processing programs, style sheets, and so on."
|
|
Example 2 |
Intro - xml:base attribute on element:
The xml:base attribute can specify an arbitrary base URI.
In file f2.xml (http://www.somewhere.com/f2.xml), the base URI is changed
by the xml:base attribute.
|
|
Example 3 |
xml:base attribute on element - another example:
The xml:base attribute can specify an arbitrary base URI.
The documents f1.xml and f2.xml
both reference the same file.
|
|
Example 4 |
No xml:base attribute at all:
If there is no xml:base attribute in the document
f1.xml (http://www.somewhere.com/f1.xml), the base URI of the document
is used.
|
|
Example 5 |
xml:base attribute on parent element:
If there is no xml:base attribute on the element,
the base URI of the element's parent element
is used.
|
|
Example 6 |
Adding xml:base attributes:
Here the base URI of the "reference" element is
constructed from the two xml:base attributes.
|
|
Example 7 |
Adding xml:base attributes - another example:
Element "reference" in file f1.xml references
file "http://www.zvon.org/a/b.xml".
|
|
Example 8 |
Nested xml:base attributes with absolute URLs:
Here the inner xml:base attribute overrides the
value set by the outer xml:base attribute.
|
|
Example 9 |
XML Base and Relax NG "externalRef" element:
The xml:base attribute affects the value
of the href attribute.
|
|
Example 10 |
XML Base and Relax NG "include" element:
The xml:base attribute affects the value
of the href attribute.
|
|
Example 11 |
XML Base and XInclude:
The xml:base attribute affects the value
of the href attribute.
|
|