p:for-each without input documents

If I remember correctly, at the moment it's not possible to use p:for-each to loop over a sequence of values; the input has to be an element or document.

However, I notice that per the current iteration of the (draft) XPath 4.0 spec, it will be possible to construct a document node in an XPath expression.  Would that mean that (if and when XPath 4.0 is supported in XProc) the following (or something similar) would work instead?

```
<p:variable name="test-suite-versions" select="distinct-values(//test-suite/@version)" as="xs:string*" />

<p:for-each>
    <p:with-input select="for $version in $test-suite-versions return document { <version>{$version}</version>}">
    ...
</p:for-each>
```

Sheila

Received on Thursday, 21 May 2026 22:35:53 UTC