Re: issue-base-param

Chimezie Ogbuji a écrit :
> Yes, this is the problem. XPath doesn't cite XML Infoset *or* XML Base 
> and *doesn't* define any notion of a base URI for its nodes. The XML 
> infoset OTOH *does* define a [base URI] for its Element Information 
> Items.So, basicaly, the xml:base = 'http://www.example.org/' in the 
> concrete XML form is lost to the underlying XPath data model.
Apologies if the following question is not relevant to that point but I 
would like to make sure I am not missing something important here.

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?

Cheers,

-- 
Fabien - http://www.inria.fr/acacia/fabien/

Received on Tuesday, 17 April 2007 12:06:47 UTC