Lists Home |
Date Index |
I mentioned earlier that XML Base is in some ways a transformation, and
that XSLT 2.0 appears to have heard of it.
I'm wondering now about a fairly simple situation. I have a group of
XHTML documents, let's say, and they all use relative URIs to represent
the links among themselves and links to resources (like images) they
use. They also use some absolute URIs and relative URIs using HTML base
or xml:base attributes to represent links to external information. I
want to archive them such that their location is absolutized, pinned to
a particular permanent home (which might, for instance, include date
To do this, I'd like to build an XSLT stylesheet. As part of that
stylesheet's work, I'd like to transform the relative URIs which
represent the original set of documents to MY absolute URI, while
preserving existing absolute URIs and honoring the intent of the
xml:base or html:base claims made in the originals.
However, XSLT and XPath appear to lack anything like an "absolutize"
function. I don't see any clear path forward for this in the context of
XSLT 1.0 and XPath 1.0, nor do my preliminary explorations of the 2.0
versions offer me much more hope on this issue.
Overall, I'm looking for a function that:
takes a URI as an argument
IF the URI is absolute, it returns the same URI
IF the URI is relative, it absolutizes it, based on:
a) xml:base if available or
b) the base URI of the document (or external entity) itself or
c) a provided base URI
(b) would be for archiving information more or less in-place, while (c)
would be for archiving the information at a different location. (a), (b)
and (c) might well be represented as separate functions.
EXSLT doesn't (yet) have such a function, though I understand that a
pair of extension functions can make this work in 4XSLT. Given the
status of XML Base as a W3C Recommendation, I have to admit that this
feels like a surprising omission from at least the latest of these
The information I can find about URIs in XSLT and XPath seems mostly
aimed at retrieving information (like documents) from within
implementations, not at processing URIs directly. Given the regularity
with which URIs cause trouble for this community, that seems like
something worth discussion.
Ring around the content, a pocket full of brackets
Errors, errors, all fall down!