Re: own defined step and xml:base "inheritance"

Well, I tried :
- base-uri()
- base-uri(.)
- base-uri(/*)

It always refers to the base-uri of the *XML file being processed* (by
default the folder where the xml file is stored), not the Xproc Pipeline
neither the xml:base attribute I've add to the XPL file.

By the way I'm not sure this is the good "pist" ? I actually have to tell
the xproc processor that my "href option" is an URI and has to be treated
like any URI : that means resolving it according to xml:base attributes if
there are some in the XPL file.

The W3C spec says :

When a relative URI appears in an option value, the base URI against which
> it must be made absolute is the base URI of the p:option<http://www.w3.org/XML/XProc/docs/langspec.html#p.option> element.
> If an option value is specified using a syntactic shortcut<http://www.w3.org/XML/XProc/docs/langspec.html#option-shortcut>,
> the base URI of the step on which the shortcut attribute appearsmust be
> used. In general, whenever a relative URI appears, its base URI is the base
> URI of the nearest ancestor element.


It doesn't say :
1) if this has to be true for custom step and not only predefined step
2) if 1) is true => how to tell that an option is a relative URI ?

I really thought adding cx:type="xsd:anyURI" would do the trick but it
doesn't. This has to do with Calabash itselft, not xproc.
Maybe I have to tell that within an XSD schema which I'll give to Calabash ?
But well I use SaxonHE which is not schema-aware anyway...

Well next step : I'll try to compile the last Calabash release and see
what's happen ("crossing figers")

Regards

Matthieu.






2013/12/16 Imsieke, Gerrit, le-tex <gerrit.imsieke@le-tex.de>

> Try base-uri(/*) since the uri will be set by the attribute on the
> top-level element rather than on the document node around that element.
>
>
> On 16.12.2013 11:05, RICAUD-DUSSARGET Matthieu wrote:
>
>> Hi Jostein,
>>
>> Thanks for your answer.
>>
>> I tried both of your solutions but unfortunately the value of base-uri()
>> is always the *base-uri of the xml file being processed* and not what I
>> wrote in the xml:base attribute :-(
>>
>> On the other hand my goal is actually to make the pipeline as simple and
>> as short as possible : I would really like to use it <igs:xslt
>> href="..."> exactly like <p:document href="..."/> which automaticaly
>> resolve the uri according to the xml:base without I need to tell it.
>>
>> This is important because the first xpl file will be used as a kind of
>> "profile file" for non xproc developpers, it really has to keep less
>> verbose as possible.
>>
>> Anyway you are right about xml:base, this is not "inheritance" (I wrote
>> it with quotes on this purpose), it's rather "implementation of xml:base
>> with declared steps".
>>
>> Thanks for your help.
>>
>> Cheers
>>
>> Matthieu
>>
>> PS : INFO
>> XML Calabash version 1.0.3 (for Saxon 9.4.x), an XProc processor.
>> Running on Saxon version 9.4.0.2, HE edition.
>> I'm not able to run my pipeline with Calabash1.0.16 because of another
>> problem I will explain in another post.
>>
>>
>>
>>
>>
>>
>> 2013/12/16 Jostein Austvik Jacobsen <josteinaj@gmail.com
>> <mailto:josteinaj@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 <mailto: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
>>
>>
>>
>>
>>
>> --
>> Matthieu Ricaud-Dussarget
>> IGS-CP - Développeur XML
>> 05 45 37 09 49
>>
>
>


-- 
Matthieu Ricaud-Dussarget
IGS-CP - Développeur XML
05 45 37 09 49

Received on Monday, 16 December 2013 11:28:35 UTC