RE: problem using with-option

> 
> A newbie question, I'm afraid. Can anybody enlighten me as to 
> why this 
> works:
> 
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="test">
>   <p:directory-list path="/some/path"/>
> </p:declare-step>
> 
> and this doesn't:
> 
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="test">
>   <p:directory-list>
>     <p:with-option name="path" select="'/some/path'"/>
>   </p:directory-list>
> </p:declare-step>

The first pipeline uses the shortcut syntax for specifying options: the
value of 'path' is just a static string.
The second pipeline uses p:with-option which evaluates an XPath
expression. But for that, p:with-option needs a context over which to
evaluate the expression. You can solve this either by providing an
explicit empty context:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="test">
  <p:directory-list>
    <p:with-option name="path" select="'/some/path'">
      <p:empty/>
    </p:with-option>
  </p:directory-list>
</p:declare-step>

If the pipeline had a primary input port, it would automatically become
the context of p:with-option. But because there is no such port, you
have to provide an explicit binding for p:with-option.

Regards,
Vojtech

Received on Tuesday, 30 June 2009 13:16:25 UTC