- From: Sheila Thomson <discuss@bluegumtree.com>
- Date: Fri, 22 May 2026 10:22:07 +0100
- To: xproc-dev@w3.org
- Message-ID: <B0CFD389-C0E2-4A9F-B5F5-91CE6F5F19B4@bluegumtree.com>
I need to start documenting workarounds somewhere easy to search so that I can "remember" them better! I'll try this one out over the weekend and report back.
Do you have any thoughts on whether the XPath 4.0 expression would theoretically work too (using a hypothetical processor that supports 4.0)?
Sheila
On 22 May 2026 09:13:52 BST, Erik Siegel <erik@xatapult.nl> wrote:
>Hi Sheila,
>
>I think you're mistaken.
>
>It should be possible to iterate over a list of values. But: There must be a document on the DRP of the for-each. So something like this should work:
>
><p:for-each>
> <p:with-input select="(1, 2, 3)">
> <dummy/>
> </p:with-input>
>
> ...
>
></p:for-each>
>
>
>I've done this in a few pipelines (running on Morgana).
>
>Regards,
>Erik Siegel
>
>
>On 22/05/2026 00:35, Sheila Thomson wrote:
>> 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 Friday, 22 May 2026 09:22:20 UTC