XQuery Reference
Reference for XQuery, the functional query language for XML data sources.
FLWOR Expressions
XQuery FLWOR expressions (For, Let, Where, Order by, Return) structure queries similar to SQL. The for clause iterates over sequences, let binds variables, where filters, order by sorts, and return constructs output. Expressions can be nested and composed for complex transformations. XQuery can construct new XML nodes, enabling transformation pipelines. The language is Turing-complete and typed.
- for
- Iterate over sequence
- where
- Filter condition
- return
- Construct output
for $b in //book where $b/price > 30 return $b/title Functions and Types
XQuery has a rich built-in function library including string, numeric, date, and node functions. User-defined functions can be declared with typed parameters and return types. The type system includes atomic types, sequences, and schema-validated nodes. XQuery Update Facility adds insert, delete, and replace operations. Full-text search extensions provide text ranking and stemming.
- built-in
- String, numeric, date funcs
- user functions
- declare function
- update
- Insert/delete/replace
fn: namespace typed params XQuery Update Facility