W3C home > Mailing lists > Public > public-grddl-wg@w3.org > April 2007

Re: issue-base-param

From: Jeremy Carroll <jjc@hpl.hp.com>
Date: Tue, 17 Apr 2007 14:04:05 +0100
Message-ID: <4624C5C5.9040009@hpl.hp.com>
To: Fabien Gandon <Fabien.Gandon@sophia.inria.fr>
CC: ogbujic@ccf.org, GRDDL Working Group <public-grddl-wg@w3.org>

Fabien Gandon wrote:
> The RDFa2RDFXML transformation is in XSLT1.0 and XPath 1.0. Unless I 
> missed something in the specs (which could be the case) there is no way 
> for me to get the IRI of the source document in this transformation i.e. 
> there is no get-base-uri() function available. Thus What I do now is this:
> <!--get the base of the current XHTML page -->
> <variable name='base' select="//*/@xml:base[position()=1]"/>
> <!-- get the url of the current XHTML page if provided as a parameter to 
> the XSLT engine -->
> <param name='url' select=""/>
> <!-- set the variable to contain the URL of the source document whether 
> it was provided by the base or as a parameter e.g. 
> http://example.org/bla/file.html-->
> <variable name='this' >
>    <choose>
>        <when test="string-length($base)>0"><value-of 
> select="$base"/></when>
>        <otherwise><value-of select="$url"/></otherwise>
>    </choose>
> </variable>
> Is there a better way to get and use the source IRI in a transformation?
> Also, it seemed to me, reading your message, that the base may change 
> for different nodes in the same document. Is that right? Is it only for 
> external entities or can several xml:base be specified in the document?

In an XML document, using XSLT 1.0, the way to get the base for any 
element is to match against self-or-ancestor to the closest xml:base.
You sort of need to cross your fingers and hope that this base is an 
absolute URI rather than a relative reference. Without doing URI 
processing, it is very hard to flatten the following XML in XSLT 1.0 and 
get the xml:base right

<a xml:base="http://example.org/">
   <b xml:base="b/">
   <a xml:base="a/">
   <a xml:base="a/">
   <b xml:base="b/">
    <a href="foo"/>
If the foo is a relative reference then I think it is


I think there might be some W3C maintained code that does not URI 
processing in XSLT 1.0. Using XSLT 2.0 is, IMO, a better solution.


However, the base-param issues are not to do with XSLT usage, but to do 
with GRDDL processing. A GRDDL processor, processes some documents, 
invokes some transforms, and  processes some transform output.
Either of the processing steps use base-params - but which URIs get 
passed? Do we respect xml:base attributes or not? Which HTTP or other 
protocol level indicators of base do we respect? Do we respect html 
<base> elements within valid HTML?

Do either library functions:
respect xml:base and/or html base?


> Cheers,

Hewlett-Packard Limited
registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England
Received on Tuesday, 17 April 2007 13:04:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:52:37 UTC