W3C home > Mailing lists > Public > public-xml-processing-model-comments@w3.org > August 2013

for-each XPath sequence item, new V2 requirement ?

From: Romain Deltour <rdeltour@gmail.com>
Date: Fri, 23 Aug 2013 23:36:13 +0200
To: XProc Dev <xproc-dev@w3.org>, XProc Comments <public-xml-processing-model-comments@w3.org>
Message-Id: <8D85EA0D-7229-4CA8-8B89-97C06CE08502@gmail.com>
Hi,

I have a use case where I want to load documents declared as a space-separated sequence of URIs in a step option. It occurred to me that there was no super-easy way to do that with vanilla XProc.

I ended up implementing a `px:tokenize` step which applies the XPath tokenize() function with the step's 3 options as arguments, and return the result as a sequence of `c:result` documents. See the implementation there:
   https://gist.github.com/rdeltour/6319457

Now, it made me want to be able to do this in XProc:

<p:for-each>
    <p:iteration-source select="tokenize($my-list,'\s+')"/>
    <!-- subpipeline processing the result sequence as `c:result` documents -->
</p:for-each>

In other words, what I'm thinking is allowing any XDM sequence as the iteration source of p:for-each (assuming vNext targets XPath 2.0):
 - if an item is a document node, pass it as-is to its sub pipeline
 - if an item is an element, pass it wrapped in a document
 - in any other cases, pass its string value as a `c:result` document

Thoughts ?

Romain.
Received on Friday, 23 August 2013 21:36:43 UTC

This archive was generated by hypermail 2.3.1 : Friday, 23 August 2013 21:36:44 UTC