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

Re: Compute attribute value with set-attribute

From: mozer <xmlizer@gmail.com>
Date: Tue, 7 Apr 2009 07:50:50 +0200
Message-ID: <21d9ade60904062250t2f214db2wd28567e6bb24d821@mail.gmail.com>
To: Florent Georges <fgeorges@fgeorges.org>
Cc: XProc Dev <xproc-dev@w3.org>
Dear,
You seem to miss the biggest trick of XProc : you should set to empty
the readable port of the with-option

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

      <p:output port="result"/>

      <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>

   </p:declare-step>
Xmlizer
On Mon, Apr 6, 2009 at 11:12 PM, Florent Georges <fgeorges@fgeorges.org> wrote:
>
>  Hi,
>
>  I want to set an attribute on an element using an XPath
> expression.  So I use the step p:add-attribute, with a
> p:with-option for the attribute-value option:
>
>    <p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
>
>       <p:output port="result"/>
>
>       <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:add-attribute>
>
>    </p:declare-step>
>
> but I get an error running this pipeline:
>
>    Error : .../bug-calabash.xproc:15: option attribute-value
>    unbound on p:add-attribute step named #ANON.86 and no default
>    readable port.
>
>  If I set the option through the attribute:
>
>    <p:add-attribute match="elem" attribute-name="a" attribute-value="value">
>       <p:input port="source">
>          <p:inline>
>             <elem/>
>          </p:inline>
>       </p:input>
>    </p:add-attribute>
>
> everything runs fine and I get the expected result:
>
>    <elem a="value"/>
>
>  I use Calabash 0.9.7.  Did I miss something obvious with the
> step p:set-attribute or with options?
>
>  Regards,
>
> --
> Florent Georges
> http://www.fgeorges.org/
>
Received on Tuesday, 7 April 2009 05:51:25 GMT

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