xsl-list
[Top] [All Lists]

Re: [xsl] XQuery/XPath 3.1: Node List to Node Set ("distinct nodes")

2021-12-28 15:56:08
On 28.12.2021 20:28, Priscilla Walmsley pwalmsley(_at_)datypic(_dot_)com wrote:

$nodes/. would re-order them in document order if that matters.

As the question says XQuery/XPath 3.1, if the order in the original
sequence / node list matters, generate-id made it from XSLT into newer
versions of XPath and XQuery I think so you could use grouping by
generate-id() plus sorting (as the normal XQuery group by clause doesn't
preserve the order necessarily)

for $node at $pos in $nodes
group by $id := generate-id($node)
order by $pos[1]
return $node[1]
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--


<Prev in Thread] Current Thread [Next in Thread>