Re: Here's a tricky one

On 5/14/07, Norman Walsh <ndw@nwalsh.com> wrote:
> <p:matching-documents>
>   <p:input port="source">
>     <p:inline>
>       <odd/>
>     </p:inline>
>     <p:inline>
>       <even/>
>     </p:inline>
>     <p:inline>
>       <odd/>
>     </p:inline>
>     <p:inline>
>       <even/>
>     </p:inline>
>     <p:inline>
>       <odd/>
>     </p:inline>
>   </p:input>
>   <p:option name="test" value="$p:position mod 2 = 1"/>
> </p:matching-documents>
>
> We added $p:position for this very case.

This is a good use case, and I agree: in this case you want that
information to be made available the 'test' XPath expression. I only
feel I should insist on two points:

1) That we clearly specify for each component what is exposed to XPath
expression evaluated by the component.
2) That we use functions. Sorry, I can't help coming back to this once
again: this example would IMHO be clearer if instead of $p:position we
had document-position(). In this case a function does a better job
than a variable at conveying that the value can be different depending
on when that function is called by the step. And the name does a
better job at describing what the function does.

Alex
-- 
Orbeon Forms - Web 2.0 Forms for the Enterprise
http://www.orbeon.com/

Received on Tuesday, 15 May 2007 08:51:31 UTC