Re: Can message expression of p:identity access items flowing through if it is a sequence of items and not a single item?

Martin Honnen <martin.honnen@gmx.de> writes:
> This works if a single item flows through but as soon as I have a
> sequence of items flowing through I get an error that the context item
> is needed but not provided.

The spec says explicitly that if the context item does not consist of
exactly one item, it’s undefined.

> So I thought I could use a collection with <p:identity collection="true"
> message="{every $item in collection() satisfies $item instance of
> array(*)}"/> but collection as an attribute doesn't seem to be allowed
> on p:identity.

No, it isn’t. It’s only allowed on variable, with-param, etc.

> Is the only way I have to debug what goes through the p:identity to
> precede my p:identity with a variable
>
>     <p:variable name="result" collection="true" select="collection()"/>
>     <p:identity message="{every $item in $result satisfies $item
> instance of array(*)}"/>

What I’d have done is put a loop around the (possible) sequence:

<p:for-each>
  <p:identity message="{. instance of array(*)}"/>
</p:for-each>

Is that workaround sufficient?

                                        Be seeing you,
                                          norm

--
Norman Tovey-Walsh <ndw@nwalsh.com>
https://nwalsh.com/

> We navigate our whole lives using words. Change and improve the words
> and I believe we can change and improve life.

Received on Friday, 9 July 2021 07:35:26 UTC