Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Saxon Xquery AssistNew to Visual Studio Code? Get it now.
Saxon Xquery Assist

Saxon Xquery Assist

Sandeep Gupta

|
1 install
| (0) | Free
Run XQuery files with Saxon, save named outputs, copy XPath values, and surface Problems in VS Code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Saxon Xquery Assist

A Visual Studio Code extension that runs XQuery using Saxon and passes XML and JSON input file paths as external variables.

Features

  • Adds command: Run XQuery with Saxon
  • Adds command: Copy XPath for Current Selection for XML editors
  • Uses currently open .xq / .xquery file, or prompts you to pick one
  • Prompts for XML and/or JSON input files on every run and lets you reuse the last selected file from a quick pick
  • Passes both inputs as external variables:
    • xmlFile=<selected XML path>
    • jsonFile=<selected JSON path>
  • Includes a bundled Saxon HE JAR inside the VSIX package so teammates do not need to install Saxon separately
  • Captures stdout and stderr
  • Saves output next to the XQuery file as <query-name>_output.xml or <query-name>_output.txt
  • Writes output to a dedicated output channel: Saxon XQuery
  • Parses Saxon errors into clickable entries in the Problems panel when line and file information is available
  • Optional setting to open results in a new editor tab
  • Copies the XPath for the current XML element or attribute to the clipboard
  • Cross-platform support for Windows, Linux, and macOS

Configuration

Open Settings and configure:

  • saxonRunner.saxonJarPath: optional absolute path to a custom Saxon JAR. If empty, the bundled JAR is used.
  • saxonRunner.openResultsInEditor: open results in a new editor tab

Example XQuery

declare variable $xmlFile external;
declare variable $jsonFile external;

let $xml := doc($xmlFile)
let $json := json-doc($jsonFile)

return (
  $xml,
  $json
)

Usage

  1. Run command: Run XQuery with Saxon
  2. If no XQuery file is open, select an .xq or .xquery file
  3. Reuse the last XML or JSON file from the quick pick, or browse for a different one
  4. View results in the Saxon XQuery output channel
  5. Open the generated <query-name>_output.xml or <query-name>_output.txt file beside the XQuery

XPath Helper

  1. Open an XML file
  2. Place the cursor on an element, text node, or attribute
  3. Run command: Copy XPath for Current Selection
  4. The extension copies the XPath to the clipboard and shows it in the Saxon XML XPath output channel

Development

npm install
npm run compile

Press F5 in VS Code to launch an Extension Development Host.

Packaging

npm install -g @vscode/vsce
vsce package

This generates a .vsix package you can install in VS Code.

Saxon Version In Use

  • If saxonRunner.saxonJarPath is set, that custom JAR is used.
  • If saxonRunner.saxonJarPath is empty, the bundled JAR is used from resources/saxon/saxon-he.jar.
  • Bundled Saxon version is managed in saxon.config.json.

Upgrading Bundled Saxon

  1. Update version in saxon.config.json.
  2. Run:
npm run refresh:saxon
npm run compile
npx @vscode/vsce package

This downloads the new Saxon JAR from Maven Central, rebuilds the extension, and produces an updated VSIX.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft