- From: Innovimax W3C <innovimax+w3c@gmail.com>
- Date: Thu, 24 May 2012 09:33:25 +0200
- To: vojtech.toman@emc.com
- Cc: public-xml-processing-model-wg@w3.org
Thanks Vojtech !!
I rediscover all the subtleties !
So here the proposal for 5.32
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
<p:output port="result"/>
<p:template>
<p:input port="template">
<p:inline>
<root>
Is XQuery available : { $has-xquery }
</root>
</p:inline>
</p:input>
<p:input port="source">
<p:empty/>
</p:input>
<p:with-param name="has-xquery" select="p:step-available('p:xquery')"/>
</p:template>
</p:declare-step>
Mohamed
On Thu, May 24, 2012 at 8:53 AM, <vojtech.toman@emc.com> wrote:
> The idea clearly was that since the p:template *step* evaluates the XPath expressions in the template document, it uses the step XPath context, in which p:step-available() (and others) are not defined. But we don't say that explicitly.
>
> We actually don't say that for p:filter, p:label-elements, p:split-sequence etc. either. But I think that sections 2.6.1 and 2.6.2 are clear enough:
>
> "When a *step* evaluates an XPath expression [...], unless otherwise indicated by a particular step, it does so with the following initial context: ..."
>
> Regards,
> Vojtech
>
> --
> Vojtech Toman
> Consultant Software Engineer
> EMC | Information Intelligence Group
> vojtech.toman@emc.com
> http://developer.emc.com/xmltech
>
>> -----Original Message-----
>> From: innovimax@gmail.com [mailto:innovimax@gmail.com] On Behalf Of
>> Innovimax W3C
>> Sent: Thursday, May 24, 2012 1:06 AM
>> To: XProc WG
>> Subject: Re: Use Case 5.32 Pipeline
>>
>> Interesting side effet
>>
>> In the process of trying to propose some alternate rewriting using
>> p:template
>>
>> I did this
>>
>> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
>> xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
>> <p:output port="result"/>
>> <p:template>
>> <p:input port="template">
>> <p:inline>
>> <root>
>> Is XQuery available { p:step-available('p:xquery') }
>> </root>
>> </p:inline>
>> </p:input>
>> <p:input port="source">
>> <p:empty/>
>> </p:input>
>> <p:input port="parameters">
>> <p:empty/>
>> </p:input>
>> </p:template>
>> </p:declare-step>
>>
>> And I get this error :
>>
>> err:XD0023 : Invalid XPath expression: ' p:step-available('p:xquery')
>> '. It is a dynamic error if an XPath expression is encountered which
>> cannot be evaluated (because it is syntactically incorrect, contains
>> references to unbound variables or unknown functions, or for any other
>> reason).
>>
>> My problem is that we didn't define in
>> http://www.w3.org/TR/xproc-template/, what the XPath context contains
>> !!
>>
>> So I cannot even blame Calabash !!
>>
>> Mohamed
>>
>>
>> On Wed, May 23, 2012 at 8:45 PM, Alex Milowski <alex@milowski.com>
>> wrote:
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
>> > xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
>> > <p:output port="result"/>
>> > <p:choose>
>> > <p:when test="p:step-available('p:xquery')">
>> > <p:identity>
>> > <p:input port="source">
>> > <p:inline><green/></p:inline>
>> > </p:input>
>> > </p:identity>
>> > </p:when>
>> > <p:otherwise>
>> > <p:identity>
>> > <p:input port="source">
>> > <p:inline><red/></p:inline>
>> > </p:input>
>> > </p:identity>
>> > </p:otherwise>
>> > </p:choose>
>> > </p:declare-step>
>>
>>
>>
>> --
>> Innovimax SARL
>> Consulting, Training & XML Development
>> 9, impasse des Orteaux
>> 75020 Paris
>> Tel : +33 9 52 475787
>> Fax : +33 1 4356 1746
>> http://www.innovimax.fr
>> RCS Paris 488.018.631
>> SARL au capital de 10.000 €
>>
>
--
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 9 52 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 €
Received on Thursday, 24 May 2012 07:34:02 UTC