W3C home > Mailing lists > Public > xproc-dev@w3.org > April 2009

RE: Compute attribute value with set-attribute

From: <Toman_Vojtech@emc.com>
Date: Tue, 7 Apr 2009 09:24:07 -0400
Message-ID: <6E216CCE0679B5489A61125D0EFEC7870F1C726A@CORPUSMX10A.corp.emc.com>
To: <xproc-dev@w3.org>
>   Nice to feel a newbie again :-)  Thanks for the response.  Indeed,
> the pipeline works.  But I can't find the difference between the two
> following pieces of code regarding p:with-option:
> 
>     <p:add-attribute match="elem" attribute-name="a">
>        <p:input port="source">
>           <p:inline>
>              <elem/>
>           </p:inline>
>        </p:input>
>        <p:with-option name="attribute-value" select="'value'">
>           <p:empty/>
>        </p:with-option>
>     </p:add-attribute>
> 
> on the one hand, that has to use p:empty and:
> 
>     <p:identity>
>        <p:input port="source">
>           <p:inline>
>              <elem/>
>           </p:inline>
>        </p:input>
>     </p:identity>
> 
>     <p:add-attribute match="elem" attribute-name="a">
>        <p:with-option name="attribute-value" select="'value'"/>
>     </p:add-attribute>
> 
> on the other hand, that seems to accept p:with-option without p:empty.
>  Well, at least the example works with Calabash and is actually used
> in one of its examples.  But I couldn't find the answer in the spec
> (neither if it is correct, and if it is the difference between both
> examples.)

In the first example, you have to use p:empty because there is no
default readable port in p:add-attribute (because you are using
p:declare-step with no input port for the top-level pipeline).

In the second example (with p:identity), there is a default readable
port (the "result" port of p:identity).

Spec 5.7.3 (p:with-option): "If a select expression is used but no
document binding is provided, the implicit binding is to the default
readable port. It is a static error (err:XS0032) if no document binding
is provided and the default readable port is undefined."

Hope this helps.

Regards,
Vojtech
Received on Tuesday, 7 April 2009 13:24:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 7 April 2009 13:24:58 GMT