Re: XPaths over document sequences

/ Jeni Tennison <jeni@jenitennison.com> was heard to say:
| Hi,
|
|>    [NEW] ACTION: Norm to record the open issue about what an XPath expression
|>    over a document sequence means [recorded in
|>    http://www.w3.org/2006/05/25-xproc-minutes.html#action01[13]]
|
| On this topic, I'd like to be able to do:
|
|   <p:choose>
|     <p:input name="input" ref="documents" />
|     <p:when test="input contains one or more documents">
|       ...
|     </p:when>

Ok, my first reaction is, for V1 let's make it an error to attempt to
evaluate an XPath over a sequence of documents. :-)

If you know (or think you might) get a sequence, then you can wrap
them in a for-each. Given a component, p:count-documents-in-sequence,
that generates <count>3</count> for a sequence of three documents,
you could write:

<p:step name="p:count-doucments-in-sequence">
  <p:input name="input" ref="documents"/>
  <p:output name="output" label="count"/>
</p:step>

<p:choose>
  <p:when ref="count" test="count &gt; 1">
    <p:for-each-document ...>
    </p:for-each-document>
  </p:when>
  <p:otherwise>
    ...
  </p:otherwise>
</p:choose>

Too odious?

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Thursday, 1 June 2006 13:49:43 UTC