- From: Jostein Austvik Jacobsen <josteinaj@gmail.com>
- Date: Mon, 16 Dec 2013 10:08:41 +0100
- To: RICAUD-DUSSARGET Matthieu <matthieu.ricaud@igs-cp.fr>
- Cc: XProc Dev <xproc-dev@w3.org>
- Message-ID: <CAOCxfQd7oYRcJ5bCjxn-=1Shxqv2vyMQSvhr4dccyGO0pfrYXw@mail.gmail.com>
You could resolve the URI each time you invoke your step:
<p:import href="common.xpl"/>
<p:pipeline type="igs:xml2ecf" xml:base="file:///C:/foo/bar/">
<igs:xslt>
<p:with-option name="href"
select="resolve-uri('xsl/igs/v2.5/main_igs_v2.5.xsl', base-uri(.))"/>
</igs:xslt>
</p:pipeline>
Alternatively, you could add a base-uri option to your step:
<p:import href="common.xpl"/>
<p:pipeline type="igs:xml2ecf" xml:base="file:///C:/foo/bar/">
<igs:xslt href="xsl/igs/v2.5/main_igs_v2.5.xsl">
<p:with-option name="base-uri" select="base-uri(.)"/>
</igs:xslt>
</p:pipeline>
The base URI of p:with-option in your last example is (almost certainly) an
absolute file URI pointing to the file you declared igs:xslt in. The
xml:base is not "inherited" in any way, and there's no "tunneling"
mechanism that could be used like there is in XSLT (although I wish there
were).
Hope this helps.
Jostein
On 16 December 2013 09:50, RICAUD-DUSSARGET Matthieu <
matthieu.ricaud@igs-cp.fr> wrote:
> Hi all,
>
> I'm using Calabash. I don't know if the problem comes from xproc
> implementation or just xproc dev.
>
> When I use a pipeline with an xml:base attribute, I can use p:xslt with
> p:document/@href relative to this xml:base :
>
> <p:pipeline type="igs:xml2ecf" xml:base="file:///C:/foo/bar/">
> <p:xslt>
> <p:input port="stylesheet"><p:document
> href="xsl/my.xsl"/></p:input>
> </p:xslt>
> </p:pipeline>
>
> As long as file:///C:/foo/bar/xsl/my.xsl exists, it works, perfect !
>
> But when I want to override p:xslt with my own step in a library, it
> doesn't work anymore :
>
> <p:import href="common.xpl"/>
> <p:pipeline type="igs:xml2ecf" xml:base="file:///C:/foo/bar/">
> <igs:xslt href="xsl/igs/v2.5/main_igs_v2.5.xsl"/>
> </p:pipeline>
>
> where common.xpl defines :
>
> <p:declare-step type="igs:xslt" name="current">
> <p:input port="source" sequence="true" primary="true"/>
> <p:input port="parameters" kind="parameter"/>
> <p:output port="result" primary="true"/>
> <p:option name="href" required="true" cx:type="xsd:anyURI"/>
> <p:load name="load_stylesheet"><p:with-option name="href"
> select="$href"/></p:load>
> <p:xslt>
> <p:input port="stylesheet">
> <p:pipe port="result" step="load_stylesheet"/>
> </p:input>
> <p:input port="source">
> <p:pipe port="source" step="current"/>
> </p:input>
> <p:input port="parameters">
> <p:pipe port="parameters" step="current"/>
> </p:input>
> </p:xslt>
> <ut:log>
> <p:with-option name="href" select="resolve-uri($debug_fileName,
> base-uri(.))"/>
> </ut:log>
> </p:declare-step>
>
> I have added cx:type="xsd:anyURI" on href option so it is affect by
> xml:base but it doesn't work either.
>
> I get an error because the xsl file is not available in the same folder as
> the xpl file.
>
> Of course I can add the xml:base on "igs:xslt" p:declare-step and it
> works. But this step is a common one and the goal is to be able to call it
> with a different xml:base each time.
>
> Do you have any advices or ideas to solve this ?
>
> Thanks in advance,
>
> Matthieu
>
>
> --
> Matthieu Ricaud-Dussarget
> IGS-CP - Développeur XML
> 05 45 37 09 49
>
Received on Monday, 16 December 2013 09:09:30 UTC