XSLT and XPath

for Visual Studio Code

Installs: 141k

AI Assistants

AI coding assistants in Visual Studio Code - such as GitHub Copilot or Claude Code - can make good use of the XSLT/XPath extension. They don't need anything special from it: the extension's problems, documentation notes and debugging output are all in forms that assistants read and write well.

Fixing problems

The problems reported by the extension's linter are standard Visual Studio Code diagnostics, shown in the Problems panel. They identify the exact symbol at issue - an unresolved variable, a function called with the wrong number of arguments, a record field that doesn't exist - so an assistant that reads the diagnostics can explain and fix them precisely, and check its own changes the same way. For example, GitHub Copilot can include the problems with #problems in a chat prompt, or fix a problem from its Quick Fix menu, and Claude Code reads them through its Visual Studio Code integration.

Documentation notes

XSLT 4.0 documentation notes - xsl:note format="xdoc-md" - use Markdown with @param and @return tags, in the style of Javadoc: a format that assistants already know. An assistant can read a function's note to understand it, and can write notes too - for example, when asked to document the functions in a stylesheet. As the extension checks the @param tags against the parameters, a missing or misnamed parameter in a note is reported straight away.

Debugging output

The output of xdm:debug() in xsl:message is plain, labelled text: each variable's value in XPath syntax, with its type where it isn't obvious, and each node with its path. Copied from the terminal into a chat, it gives an assistant the actual values to reason about, rather than a description of the problem.

Running XSLT

Quick Run creates ordinary tasks in the workspace's tasks.json file, and each task shows the Saxon command line it runs in the terminal. An assistant that can run commands can run a transform in the same way.

Current limitations

The extension doesn't yet provide an MCP server or language model tools, so an assistant can't ask it directly for information - for example, to check a file that isn't open, to find where a symbol is declared, to list the fields of a record type, or to show the imports of a module. Assistants that run outside Visual Studio Code, such as command-line agents, only see the extension's problems if they can read Visual Studio Code's diagnostics. Tools for assistants may be added in a future release.