Can someone explain what the xml:base attribute is used for in XHTML5?
html, xml
Solution
Documentation for the `xml:base` can be found here. It allows a redefinition of the base address used by relative addresses in child elements.
This is the example for that source,
<?xml version="1.0"?>
<doc xml:base="http://example.org/today/"
xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<title>Virtual Library</title>
</head>
<body>
<paragraph>See <link xlink:type="simple" xlink:href="new.xml">what's
new</link>!</paragraph>
<paragraph>Check out the hot picks of the day!</paragraph>
<olist xml:base="/hotpicks/">
<item>
<link xlink:type="simple" xlink:href="pick1.xml">Hot Pick #1</link>
</item>
<item>
<link xlink:type="simple" xlink:href="pick2.xml">Hot Pick #2</link>
</item>
<item>
<link xlink:type="simple" xlink:href="pick3.xml">Hot Pick #3</link>
</item>
</olist>
</body>
</doc>
In this case the "What's new" link points to `http://example.org/today/new.xml`, which is the `doc` element's `xml:base` absolute address plus the `xlink:href` attribute's relative address.
The `olist` element's `xml:base` address redefines the base address, using the domain of `doc`'s `xml:base` but changing the path. So the subsequent links are relative to `http://example.org/hotpicks/`.
Problem
I was wondering what does the xml:base attribute do and what are it's values in XHTML5. and does the xml:base attribute have any restrictions?