Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

speedata/goxpath

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Explore in Constellation

goxpath

An XPath 3.1 evaluator written in Go — 85% W3C conformance (~19,000 of ~22,200 applicable QT3 tests passing).

Built on goxml for the XML tree model.

Features

  • Full XPath 3.1 expression language (let, for, if, arrow, maps, arrays, inline functions, dynamic calls)
  • 150+ XPath/XQuery functions including math, higher-order, JSON, date/time formatting
  • Typed numeric system (xs:double, xs:float, xs:decimal, xs:integer with subtype hierarchy)
  • Named function references, dynamic function calls, function-lookup
  • DecimalFormat API for customizable number formatting
  • Per-test regression detection against a W3C QT3 baseline

Usage

xp, _ := goxpath.NewParser(strings.NewReader(`<root><item id="1">Hello</item></root>`))
result, _ := xp.Evaluate("//item[@id='1']/text()")
fmt.Println(result) // [Hello]

See pkg.go.dev for the full Go API.

Testing

# Run all tests including W3C QT3 conformance (~2s)
git clone --depth 1 https://github.com/w3c/qt3tests.git testdata/qt3tests
go test ./...

# Update baseline after improvements
QT3_UPDATE_BASELINE=1 go test -run TestQT3Survey

The test suite compares each run against testdata/qt3_baseline.txt (~19,000 test names). Any regression is reported as a test failure with the specific test name.

Known Limitations

  • Regex back-references (\1, \2) are not supported (Go RE2 engine limitation)
  • Unicode Collation Algorithm (UCA): supported via golang.org/x/text/collate. lang, strength, numeric and fallback parameters are honored; caseFirst, caseLevel, alternate, maxVariable, reorder, backwards, version, normalization are accepted lax but not effectively applied (raise FOCH0002 with fallback=no).
  • Integer precision is limited to int64 (~9.2 × 10¹⁸); the spec requires arbitrary precision
  • Decimal is stored as float64 (~15-17 significant digits)
  • Timezone handling may add or omit timezone indicators in edge cases
  • Not implemented: fn:transform(), fn:idref(), namespace:: axis, schema-aware types

See the full limitations reference for details.

Documentation

Full reference at https://doc.speedata.de/goxml/ — includes language features, type system, all function categories, Go API, and known limitations.

Ecosystem

goxpath is part of a broader ecosystem of PDF, typesetting and publishing technologies.

Explore the constellation →

License

BSD-3-Clause — see License.md.

Releases

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.