Since xq bundled along with kislyuk/yq uses jq underneath for DSL, you can use the tonumber function to convert the .count to their numeric equivalent

Copyxq '.groups.a | map( (.count, .max) |= tonumber )' xml
[
  {
    "count": 1,
    "max": 46,
    "name": "foo"
  },
  {
    "count": 3,
    "max": 81,
    "name": "bar"
  }
]
Answer from Inian on Stack Overflow
🌐
GitHub
github.com › sibprogrammer › xq
GitHub - sibprogrammer/xq: Command-line XML and HTML beautifier and content extractor · GitHub
Command-line XML and HTML beautifier and content extractor - sibprogrammer/xq
Starred by 1.1K users
Forked by 33 users
Languages   Go 92.6% | HTML 4.7% | Shell 2.2% | Dockerfile 0.5%
🌐
Ubuntu
manpages.ubuntu.com › manpages › noble › man1 › xq.1.html
Ubuntu Manpage: xq - command-line XML and HTML beautifier and content extractor
Format an XML file and highlight the syntax: $ xq test/data/xml/unformatted.xml Utility also accepts input through stdin: $ curl -s https://www.w3schools.com/xml/note.xml | xq HTML content can be formatted and highlighted using -m flag: $ xq -m test/data/html/formatted.html Extract the text content of all nodes with city name: $ cat test/data/xml/unformatted.xml | xq -x //city ·
Discussions

How to parse XML into JSON with xq and output specific elements as numbers? (instead of strings) - Stack Overflow
I'm not too well versed when it comes down to xq/jq... I've been trying to parse something like this: 1 More on stackoverflow.com
🌐 stackoverflow.com
Show HN: Xq – command-line XML and HTML beautifier and content extractor
xq looks interesting for pure XML, will add it to my notes · Regarding xmlstarlet, I don't use it much but here's some stuff from my notes: More on news.ycombinator.com
🌐 news.ycombinator.com
33
104
November 14, 2022
xq: command-line XML beautifier and content extractor (written in Go)
My favorite tool to deal with xml is rm. Jokes aside thanks for helping make xml more tolerable. More on reddit.com
🌐 r/golang
6
45
November 13, 2021
yq - Parsing XML to CSV using xq and jq - Stack Overflow
There is some terminal command for parsing xml to csv in python xq syntax (also python-yq installed required): More on stackoverflow.com
🌐 stackoverflow.com
🌐
Ashby
ashbyhq.com › blog › engineering › jq-and-yq
Querying JSON and XML with jq and xq | Ashby
January 9, 2022 - Before we launched with the vendor, I needed to figure out how many jobs would be impacted. I figured there must be an equivalent for XML, right? There is, and it's a tool called yq that wraps jq and supports multiple other formats. It ships with a tool called xq that you can use for XML.
🌐
GitHub
github.com › jeffbr13 › xq
GitHub - jeffbr13/xq: Like jq, but for XML and XPath.
Like jq, but for XML and XPath. Contribute to jeffbr13/xq development by creating an account on GitHub.
Starred by 103 users
Forked by 3 users
Languages   Python 100.0% | Python 100.0%
🌐
Dzu's Blog
blog.lazy-evaluation.net › posts › linux › jq-xq-yq.html
jq, xq and yq - Handy tools for the command line | Dzu's Blog
April 27, 2020 - It turns out that there are converters for YAML and XML to JSON and thus can be easily combined into an command-line YAML and XML processor. Having installed yq with the Python packager pip, we get the yp binary for working with YAML files and the xq binary for XML.
🌐
Kislyuk
kislyuk.github.io › yq
yq: Command-line YAML/XML/TOML processor
yq also supports XML. The yq package installs an executable, xq, which transcodes XML to JSON using xmltodict and pipes it to jq. Roundtrip transcoding is available with the xq --xml-output/xq -x option. Multiple XML documents can be passed in separate files/streams as xq a.xml b.xml.
🌐
Hacker News
news.ycombinator.com › item
Show HN: Xq – command-line XML and HTML beautifier and content extractor | Hacker News
November 14, 2022 - xq looks interesting for pure XML, will add it to my notes · Regarding xmlstarlet, I don't use it much but here's some stuff from my notes:
Find elsewhere
🌐
GNU
gnu.org › software › qexo › XQ-Gen-XML.html
Generating XML and HTML using XQuery
The Qexo (http://www.gnu.org/software/qexo/) implementation of XQuery includes a write-to built-in function. It takes two parameters—a value (normally an element node) and a file name—and writes the former to the latter, using HTML-compatible XML (XHTML) syntax.
🌐
GitHub
github.com › otobrglez › xq
GitHub - otobrglez/xq: Command-line XPath processor for HTML and XML
xq is a lightweight command-line XPath processor for HTML and XML.
Author   otobrglez
🌐
Reddit
reddit.com › r/golang › xq: command-line xml beautifier and content extractor (written in go)
r/golang on Reddit: xq: command-line XML beautifier and content extractor (written in Go)
November 13, 2021 - Cool! You’re obviously inspired by jq for json files? That‘s an extremely useful tool — almost better usability than many json libraries. So I look forward to see whether this one can be as useful for XML.
🌐
Stack Overflow
stackoverflow.com › questions › 63158218 › parsing-xml-to-csv-using-xq-and-jq
yq - Parsing XML to CSV using xq and jq - Stack Overflow
xq -r '["id","available","price","name","description","category","size"], (.yml_catalog.shop.offers.offer[] | [."@id", ."@available", .price, .name, .description, .param[]."#text"]) | @csv' xml
🌐
GitHub
github.com › kislyuk › yq
GitHub - kislyuk/yq: Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents · GitHub
yq also supports XML. The yq package installs an executable, xq, which transcodes XML to JSON using xmltodict and pipes it to jq. Roundtrip transcoding is available with the xq --xml-output/xq -x option.
Starred by 2.9K users
Forked by 86 users
Languages   Python 94.7% | Makefile 5.3%
🌐
Medium
lovethepenguin.com › xq-or-how-to-use-jq-with-xml-files-c486390313ff
xq: or how to use jq with XML files | by Konstantinos Patronas | Medium
August 14, 2023 - JSON is currently more popular than XML and there is a great tool to filter, query and transform JSON files its called jq, but since XML is still used by many legacy applications would be nice to have a command line tool like jq to work with XML files? actually we have and is called xq and is a wrapper for jq which adds support for XML files, lets see how we can install xq and use it with XML files.
🌐
Hacker News
news.ycombinator.com › item
There is `xq` today, which parses XML like `jq`. I think that it is relatively u... | Hacker News
September 7, 2021 - There is also `xmlstarlet` for parsing XML in a similar fashion · Is this the yq? https://kislyuk.github.io/yq/ It does contain an 'xq', as a literal wrapper for jq, piping output into it after transcoding XML to JSON using xmltodict https://github.com/martinblech/xmltodict (which explodes ...
🌐
Hexmos
hexmos.com › freedevtools › c › utils › xq
xq - XML Query Tool | Convert XML to Text - utils Cheatsheets | Online Free DevTools by Hexmos
Convert XML to text format easily with this command-line utility. xq is a powerful command-line utility designed for querying XML files. It allows developers to easily extract specific data points from XML documents, transforming them into a ...
🌐
Go Packages
pkg.go.dev › github.com › sbowman › xq
xq command - github.com/sbowman/xq - Go Packages
August 24, 2020 - github.com/sbowman/xq · Open Source Insights · A simple XML parser that exposes the https://github.com/antchfx/xmlquery to the command line. Use XPath queries to search for information in XML documents, or execute basic XPath expressions to convert data.
🌐
SourceForge
sourceforge.net › projects › xq-code.mirror
xq download | SourceForge.net
December 23, 2024 - Download xq for free. Command-line XML and HTML beautifier and content extractor. Command-line XML and HTML beautifier and content extractor. Syntax highlighting, automatic indentation, and formatting.