Select items and discover columns

The separate XPath library selects a window of words and derives XML table columns. head, tail, subsequence and reverse preserve the items they select, including native XML nodes.

Sequence positions start at 1. Start and length round to the nearest integer, with ties toward positive infinity; zero or negative bounds may produce fewer items. Reversal applies to the selected window. Duplicate counting uses distinct-values with exact, case-sensitive Unicode codepoint comparison. Tokenization splits only XML whitespace, so non-breaking spaces remain inside a word.

The table considers each row's attributes before its child elements. Its XPath expression explicitly keeps the first column with each node kind, local name and namespace URI. It does not rely on the implementation-dependent order of distinct-values. Repeated cells join with “ / ”; ∅ means missing and "" means empty.

XML uses the explicit native reader view and is limited to 32 KiB, 64 levels and 4096 events. Shared XPath item, text and work budgets bound these examples. The current duplicate-removal slice supports strings, untyped values, URIs, booleans and numerics with the Unicode codepoint collation; other collations and atomic families remain unsupported.

See also

XPath stable sorting

XPath maps and arrays · XPath numeric aggregates

XPath XML tables and trees · String functions · Multi-format data tables