XPaths over document sequences (Was: Re: XProc Minutes 25 May 2006)

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>
     <p:otherwise>
       ...
     </p:otherwise>
   </p:choose>

If the input documents were assigned to a variable, this would be easy:

   <p:choose>
     <p:input name="input" select="$documents" />
     <p:when test="count($input) >= 1">
       ...
     </p:when>
     <p:otherwise>
       ...
     </p:otherwise>
   </p:choose>

I can't work out how you'd do it under the scheme of providing a context 
node for evaluating XPaths. I guess you'd have to use a separate 
component to do the counting:

   <p:step name="my:count">
     <p:with-input name="input" ref="documents" />
     <p:with-output name="output" label="count" />
   </p:step>
   <p:choose>
     <p:input name="input" ref="documents" />
     <p:param name="count" context="count" select="." />
     <p:when test="$count >= 1">
       ...
     </p:when>
     <p:otherwise>
       ...
     </p:otherwise>
   </p:choose>

Right?

Cheers,

Jeni
-- 
Jeni Tennison
http://www.jenitennison.com

Received on Friday, 26 May 2006 08:51:44 UTC