SAXONB-XQUERY(1)

✨ saxonb-xquery(1) ✨ β€” the command line XQuery processor

okay bestie, welcome to section 1 of the manual, this is the saxonb-xquery era and we're gonna get you fluent in it πŸ’–


πŸ’« NAME πŸ’«

saxonb-xquery β€” command line XQuery processor. that's it, that's the vibe πŸ¦‹


🌸 SYNOPSIS 🌸

saxonb-xquery [OPTION...] QUERYFILE [NAME=VALUE...]

πŸŽ€ DESCRIPTION πŸŽ€

So this page is the lil manual for the saxonb-xquery command, and ngl it exists purely because the Debianβ„’ distribution needed it β€” the original program never shipped a manpage of its own 😭. It does have HTML documentation though, and that lives in the libsaxonb-java-doc package, iykyk.

saxonb-xquery is a command line wrapper around the Saxon-B XSLT and XQuery processor. The whole point? You can evaluate XQuery queries straight from the command line, no cap. Under the hood it's a wrapper around the Java class net.sf.saxon.Query, which is implemented by Saxon-B πŸ”₯

The way you call it: you pass a required filename containing the XQuery query you want evaluated. And listen β€” the special filename "-" can be given if you want it to read the query from standard input instead πŸ‘‘

Before the query filename, you can hand it a list of options β€” see below, we get into all of them.

🧚 Parameters

At the end of the command line, a list of parameters can be given. Parameters use the syntax NAME=VALUE, so you're specifying parameter names and their values, periodt.

  • A parameter name prefixed with "+" (plus sign) gets interpreted as a filesystem path parameter. If the path points to a single file, that file is parsed as XML and its document node gets passed as the parameter value. If the path points to a directory, all directly contained files get parsed as XML files, and the sequence of their document nodes gets passed as the parameter value 🌈
  • A parameter name prefixed with "!" (exclamation mark) gets interpreted as an output/serialization parameter. Peep the specifications of XQuery and XSLT 2.0 if you want more on output/serialization parameters.
  • To pass parameters that belong to a non-null namespace, the syntax {uri}localname=value is provided πŸ’…

Parameters will be visible as external variables during query evaluation β€” but only provided they've been declared in the query prolog, so don't come crying if you skipped that part. See the XQuery specification for more on variables and their declarations.


✨ OPTIONS ✨

A summary of supported options is included below. Options can be passed in any order, no stress 🫢

We first report the options shared by saxonb-xquery and saxonb-xslt, then the ones specific to saxonb-xquery (or the ones that have different semantics).

Some options are flagged as "Saxon-SA only" β€” those only work if Saxon-SA is installed. Heads up: Saxon-SA is a commercial product, so it is not available in Debian. πŸ’€

🌟 Common options

  • -cr:classname β€” specify a class to be used for processing collection URIs passed to the collection() function. The class must implement net.sf.saxon.CollectionURIResolver.
  • -dtd: {[on] | [off]} β€” enable or disable DTD validation. Default: off.
  • -expand: {[on] | [off]} β€” when validation is enabled, expand default values in validated documents. This option enables or disables such an expansion. Default: on.
  • -explain [:filename] β€” display an execution plan; the output is in XML format. If filename is not given it will be displayed on standard output.
  • -ext: {[on] | [off]} β€” enable or disable the ability to invoke external Java functions from query files and stylesheets. Beware: enabling them is a potential security risk when processing untrusted files. Default: off.
  • -l: {[on] | [off]} β€” keep (when on) or throw away (when off) line numbers in trees corresponding to source documents. When kept, line numbers can be accessed using the function saxon:line-number(). Default: off.
  • -outval: {[recover] | [fatal]} β€” when validation is required, set whether validation errors are fatal (when "fatal" is passed) or if they only trigger warnings (when "recover" is). Default: fatal.
  • -p: {[on] | [off]} β€” enable or disable usage of the PTreeURIResolver. Saxon-SA only.
  • -r:classname β€” specify a class to be used for resolving all URIs.
  • -repeat:N β€” repeat the transformation N times. For benchmarking purposes.
  • -sa β€” perform schema-aware processing. Saxon-SA only.
  • -strip: {[all] | [none] | [ignorable]} β€” specify the whitespace stripping policy for source documents: strip all of them ("all"), strip none of them ("none"), strip ignorable whitespace only ("ignorable"). Default: none.
  • -t β€” display version, timing, and other debugging information on standard error.
  • -tree: {[tiny] | [linked]} β€” select the implementation of the internal tree model: tiny tree model ("tiny") or linked tree model ("linked"). See the Saxon documentation for more on the internal tree model. Default: tiny.
  • -T [:classname] β€” trace various aspects of the processing; an optional class name can be given to specify a user-chosen tracer. The class must implement net.sf.saxon.trace.TraceListener. The default is a system supplied tracer. This option implies -l.
  • -TJ β€” enable tracing of external Java method invocation. See -ext.
  • -u β€” force interpretation of source document names as URI. By default they are considered to be file names, unless they start with "file:" or "http:".
  • -val: {[strict] | [lax]} β€” when validation is enabled, choose among "strict" or "lax" validation. Saxon-SA only.
  • -x:classname β€” specify a class to be used as SAX parser for input documents. The class must implement either org.xml.sax.Parser or org.xml.sax.XMLReader.
  • -xi β€” apply XInclude processing to all input documents.
  • -xmlversion: {[1.0] | [1.1]} β€” choose the XML version for processing input documents. "1.1" must be specified to process XML 1.1 and Namespaces 1.1 constructs. Default: 1.0.
  • -? β€” display a help message and exit.

πŸ¦‹ Options specific to saxonb-xquery

  • -mr:classname β€” use the specified class as a ModuleURIResolver to resolve query module URIs. The class must implement net.sf.saxon.query.ModuleURIResolver.
  • -o:filename β€” send the query output to the specified filename. If not specified, the output will be sent to standard output. See also -wrap.
  • -pipe: {[push] | [pull]} β€” internally, execute query in push or pull mode. Mainly for testing purposes. Push mode is usually faster when intermediate trees are constructed in memory. Default: push.
  • -projection: {[on] | [off]} β€” enable or disable document projection, i.e. the ability to throw away tree parts which will not be accessed by a query. Saxon-SA only.
  • -s: {[file] | [URI]} β€” read document input from the specified filename ("-" can be given to read from standard input). The read document will be available to the query as the context node. -u affects how filename is interpreted.
  • -wrap: {[on] | [off]} β€” enable or disable wrapping of query result in an XML structure which makes explicit the kind of each output node or atomic value. For example, free-standing attributes will be wrapped in an explicit XML element stating that they are attributes. When this is off, the query output will be wrapped only using a document node; in such a setting it is possible that output parts, such as free-standing attributes, can't be serialized. Default: off.

πŸ‘€ SEE ALSO πŸ‘€

  • saxonb-xslt (1)
  • XQuery 1.0: An XML Query Language (W3C Recommendation)

This program is fully documented by the HTML documentation of Saxon, available in the libsaxon-java-doc Debian package πŸ“š


πŸ’œ AUTHOR πŸ’œ

This manual page was written by Stefano Zacchiroli <zack@debian.org> for the Debianβ„’ system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation.

On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.


Copyright Β© 2008 Stefano Zacchiroli


and that's the whole page bestie, we ate that πŸ’…βœ¨ it's from February 2008, and yeah, it's SAXONB-XQUERY(1) all the way down πŸŽ€ go run some queries, you got this 🫢