An XPath 2.0+ evaluator written in Go with selected XPath 3.1 functions (maps, arrays, JSON).
Built on goxml for the XML tree model.
doc, _ := goxml.Parse(strings.NewReader(`<root><item id="1">Hello</item></root>`))
xp := &goxpath.Parser{Ctx: goxpath.NewContext(doc)}
result, _ := xp.Evaluate("//item[@id='1']")
fmt.Println(result) // HelloSee pkg.go.dev for the full Go API.
The full XPath function reference is at:
https://doc.speedata.de/goxml/
String, numeric, date/time, sequence, node, QName, URI, regex, JSON (json-to-xml, xml-to-json), map and array functions. See the documentation for the complete list.
MIT — see LICENSE.