Skip to main content
100%

Counters and Positions

✓ Published0🌍 Public
CCliffordAnderson
Last edited Aug 23, 2015
Created on Aug 23, 2015

This example demonstrates how XQuery 3.1’s `count` clause tracks the number of items that pass a `where` filter while `at $position` retains the original index in the input sequence. It processes the range 1 to 10, selecting even numbers, and returns their values with both the filtered counter and the unfiltered position attributes. The code uses the XQuery `element` constructor to build the output items, showing how counter and position diverge for excluded values.

AI-generated description

Similar vizzes