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"/> </b> </a> </a> </b> </a> If the foo is a relative reference then I think it is http://example.org/b/a/a/b/foo 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: embeddedRDF and glean-profile respect xml:base and/or html base? Jeremy > > Cheers, > -- Hewlett-Packard Limited registered Office: Cain Road, Bracknell, Berks RG12 1HN Registered No: 690597 EnglandReceived on Tuesday, 17 April 2007 13:04:32 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:11:48 GMT