for-each XPath sequence item, new V2 requirement ?
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:
Now, it made me want to be able to do this in XProc:
<!-- subpipeline processing the result sequence as `c:result` documents -->
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