Re: Changing base URIs

On 4/3/08, Norman Walsh <ndw@nwalsh.com> wrote:
> I think the problem that Toman raises in message #83 is significant.
>  Although many of the particular cases can be worked out with XPath 2.0
>  and with XSLT, I wonder if we should consider a new atomic step,
>  p:set-base-uri:
>
>  <p:declare-step type="p:set-base-uri">
>   <p:input port="source"/>
>   <p:output port="result"/>
>   <p:option name="base-uri"/>
>  </p:declare-step>
>
>  Where we define base-uri, like replace in p:string-match, as an XPath
>  Expression.
>
>  The result of this step is a new document, identical to the source,
>  except that it has a new base URI.
>
>  The 'base-uri' expression is evaluated *by the step*. I think we have
>  a step that sets a variable binding automatically (though I can't find
>  that in the current draft???), so we could say that $p:current-base-uri
>  is set to the base URI of the source document. This gives XPath 1.0
>  implementations a mechansim for writing things like this:
>
>   <p:set-base-uri base-uri="concat(substring-before($p:current-base-uri,'.xml'),'-processed.xml')"/>

Another position is if it isn't in XPath 1.0, you lose.

I've run into the need for the base URI over and over with XPath 1.0 and
XSLT 1.0 and I've had to do all kinds of unnatural acts to fix that.  While this
solution seems technically solid (and not unnatural in any way), it does
strike me as trying to fix this omission from XPath 1.0.  I'd rather say,
"you should use an XProc implementation that supports XPath 2.0".


-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Thursday, 3 April 2008 14:55:07 UTC