[widgets] restrictions on XML base

To compliment the new i18n model, I've added the following
restrictions on XML base:
[[
xml:base attribute
The xml:base attribute may be used in a configuration document to
specify a base URI other than the base URI of the document. For the
purpose of this specification, the value of xml:base attribute is
restricted to an absolute path to a folder that must exist inside the
widget package. If the said folder does not exist inside the widget
package, then the user agent must ignore this attribute, meaning that
the user agent must continue to either use the configuration
document's location within the package as the value of xml:base; or
continue to use the value of any correctly declared xml:base attribute
in the ancestor chain. When the xml:base attribute is absent, the base
URI will be the folder in which the configuration document resides.
The value of xml:base attribute must be declared as a URL encoded zip
relative path (the term URL encoded is defined in the [URI]
specification).
]]

The use case here is that an author might want to override
element-based localization so URIs are dereferenced to a folder of
their choice. This might be the case if the author has the following
folder/file structure:

/config.xml
/Content/index.html
/Content/... other files ...

So, in the config, file, the author could set XML base like so:

<widgets ... xml:base="/Content">
 ... other elements
</widgets>

In step 7, XML base will be dynamically set for the whole document
after parsing but prior to processing. The parser will then respect
any xml:base attributes it encounters during processing.

This, however, exposes a tiny limitation with the flat structure of
the configuration document: if the author, for instance, wanted to
only apply xml:base to a group of related elements, she would need to
do it per element (as we don't have container elements for element
types):

<screenshot xml:base="/screenshots/" src="bla.jpg" />

Of course, if they were going to do the above, they should just use
absolute paths for URI attributes:

<screenshot xml:base="/screenshots/bla.jpg" />

Kind regards,
Marcos
-- 
Marcos Caceres
http://datadriven.com.au

Received on Friday, 20 March 2009 09:47:30 UTC