xquery4 1.6.13

dotnet tool install --global xquery4 --version 1.6.13
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local xquery4 --version 1.6.13
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=xquery4&version=1.6.13
                    
nuke :add-package xquery4 --version 1.6.13
                    

xquery

Command-line XQuery 3.1/4.0 processor for .NET. Query XML documents from the terminal using the PhoenixmlDb XQuery engine.

Installation

dotnet tool install -g xquery4

Usage

# Query an XML file
xquery '//book/title' library.xml

# Count elements
xquery 'count(//item)' catalog.xml

# Read from a query file
xquery -f transform.xq input.xml

# Query a directory of XML files
xquery 'collection()//product[price > 50]' ./data/

# JSON output
xquery -o json 'map { "count": count(//item) }' data.xml

# Read from stdin
cat data.xml | xquery '//item/@name'

# Show execution plan
xquery --plan 'for $x in 1 to 10 return $x * $x'

# Show timing breakdown
xquery --timing '//item' large-catalog.xml

Features

  • XQuery 3.1/4.0 — FLWOR, maps/arrays, higher-order functions, string constructors
  • Multiple output methods — adaptive, XML, text, JSON
  • Context item — input XML is available as . (standard XQuery)
  • Multiple sources — files, directories, URLs, stdin
  • Full prolog support — namespaces, variable/function declarations, serialization options
  • Execution plans — inspect how queries are compiled and optimized
  • Timing — built-in performance profiling

Documentation

Full documentation at phoenixml.dev

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.6.13 48 9/4/2026
1.6.12 50 9/1/2026
1.6.11 73 8/29/2026
1.6.10 71 8/29/2026
1.6.9 67 8/27/2026
1.6.8 63 8/26/2026
1.6.7 72 8/24/2026
1.6.6 72 8/23/2026
1.6.5 76 8/21/2026
1.6.2 84 8/16/2026
1.6.1 77 7/31/2026
1.6.0 88 7/27/2026
1.5.5 98 7/12/2026
1.5.4 84 7/9/2026
1.5.3 85 7/8/2026
1.5.2 86 7/7/2026
1.5.1 99 6/30/2026
1.5.0 85 6/28/2026
1.4.7 97 6/25/2026
1.4.6 103 6/17/2026
Loading failed

Two fixes, both the same mistake: a spec-defined operation on `xs:QName` delegating to
`QName.ToString()`, which renders the EQName form `Q{uri}local` as soon as an expanded namespace
is attached. That is a good rendering for a debugger and the wrong one for a value.

This release exists to unblock the XSLT engine. There, `$err:code` could not carry its namespace
URI at all — attaching one changed how the value printed — so a caught error code could never
compare equal to `QName('http://www.w3.org/2005/xqt-errors', 'XTTE0570')`, which is how a
stylesheet (and XSpec) asserts on an error code.

### Casting `xs:QName` to `xs:string` gave the EQName form, not the lexical one

`ConcatFunction.XQueryStringValue` had no QName branch, so the value fell through to
`QName.ToString()`. XPath 3.1 §19.2 requires the lexical form — `prefix:local`, or the bare local
name when there is no prefix.

### `fn:deep-equal` compared QNames by their debug rendering

It fell through to `string.Equals(a.ToString(), b.ToString())`. So the same name spelled two ways
— `Q{uri}local` from a QName carrying an expanded namespace, `prefix:local` from one carrying
only a runtime namespace — compared **unequal**. It now compares namespace URI plus local name
and ignores the prefix: the identical rule the `eq` operator has always applied a few hundred
lines away in the same file. `deep-equal` simply never reached it.

That one was masking a defect in the XSLT engine as well. XSpec's `catch_stylesheet` asserts an
error code against `xs:QName('error-code-of-my-template')`; three of those assertions passed only
because a namespace difference is invisible when both sides render as the bare local name.
Comparing by value turned them red, which is how the XSLT-side bug (an `xmlns=` default leaking
into `xs:QName()` casts) was found and fixed.

`PhoenixmlDb.Core`'s `QName.ToString` is deliberately untouched: the two renderings serve
different audiences, and the fix belongs where the spec-defined conversion happens rather than in
a general-purpose `ToString`.

Measured with the companion XSLT changes on XSpec's 284-suite corpus: five suites better, and the
three that an earlier attempt at this regressed (`yes-no-utils`, `xsl-result-document`,
`external_xslt-package_arith_private`) all back to baseline.