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

Re: Compute attribute value with set-attribute

From: David A. Lee <dlee@calldei.com>
Date: Tue, 7 Apr 2009 11:50:23 -0400
Message-ID: <7FECB5BE7D204CF69AE9FDC485278E15@calldei.com>
To: "James Sulak" <jsulak@gmail.com>, "XProc Dev" <xproc-dev@w3.org>
This was discussed in detail beginning here :
http://markmail.org/message/pct65tn7p7rj7ky5

And the WG decided to leave it 'as is' for the reasons you mention.

Although I still belive its 'non-ideal' I accept consistancy over idealism 
:)


----- Original Message ----- 
From: "James Sulak" <jsulak@gmail.com>
To: "XProc Dev" <xproc-dev@w3.org>
Sent: Tuesday, April 07, 2009 11:29 AM
Subject: Re: Compute attribute value with set-attribute


It's kind of a shame that in situations the p:with-option select
expression doesn't require any context, the user is still required to
supply one.  For example:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">

    <p:output port="result"/>

    <p:option name="option-a" select="'Hello'"/>
    <p:option name="option-b" select="'World!'"/>

    <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="concat($option-a, ' ', $option-b)">
            <p:empty/>
        </p:with-option>
    </p:add-attribute>

</p:declare-step>

This is a potential gotcha for pipeline writers. On the face of it,
p:empty is superfluous. A solution would be to allow XProc
implementations to conditionally ignore the lack of context when it
doesn't need it.

This is just an idea; I'm not sure if it's actually a good one.  In
practice, I doubt this problem will happen much, since steps generally
have a default readable port available.  And the current approach has
the virtue of consistency, even if it is more verbose.

-James



On Tue, Apr 7, 2009 at 9:27 AM, Florent Georges <fgeorges@gmail.com> wrote:
> 2009/4/7 ? wrote:
>
>> 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).
>
> Thanks! I think I got it now. I think I mixed up the source for
> the step and for the with-option. The following example shows the
> difference between both:
>
> <p:identity>
> <p:input port="source">
> <p:inline>
> <what>world</what>
> </p:inline>
> </p:input>
> </p:identity>
>
> <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="
> concat('Hello, ', what, '!')"/>
> </p:add-attribute>
>
> ==>
>
> <elem a="Hello, world!"/>
>
> Thanks! Regards,
>
> --
> Florent Georges
> http://www.fgeorges.org/
>
>
Received on Tuesday, 7 April 2009 15:51:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 7 April 2009 15:51:06 GMT