Urðr-XMLUrðr-XML checks TEI and other XML documents against their schemas as you type, and checks XSLT, XQuery and XPath. It runs and previews XSLT transformations, and it reads TEI ODD files as schemas. It uses the engine of Urðr, an XML database for digital humanities work, built into the extension as WebAssembly. You don't need Java, Saxon or an Urðr server. Getting startedInstall Urðr-XML from the Extensions view, then open an XML file that names its schema. It works in desktop VS Code and in VS Code for the Web (vscode.dev and github.dev). Problems show up in the editor and in the Problems panel. The examples folder has a document for each feature, and its
README says what each file should show. You can download it as
ValidationA document is checked against the schemas it names:
For example, a TEI document:
Schemas given by a web address are downloaded the first time and kept,
so the TEI schemas are read once. Turn this off with
XSLT 3.0 stylesheets and XQuery 3.1 modules are checked too, with the stylesheets they include or import and the library modules they import. They stop at the first error, as an XSLT or XQuery processor does, so fix one to see the next. XQuery files also get syntax colours, which VS Code doesn't have on its own. Suggestions and hoversWhile you type, the schema suggests the elements allowed at that point (with their required attributes), attributes, attribute values and the closing tag. Hovering over an element or attribute shows the schema's documentation for it, such as the TEI Guidelines' description, along with its attributes and what it may contain. Editing elementsThese actions work as in Oxygen XML Editor, with Oxygen's keys in XML and XSLT files. Each is also in the Command Palette under Urðr-XML.
In XML files these keys replace VS Code's own: TEI ODD filesA document can name an ODD as its schema:
The extension compiles the ODD with the TEI Stylesheets (odd2odd, then odd2relax) and checks the document against the result, including the ODD's Schematron constraints. Suggestions and hovers use it too. The first compile takes from a few seconds for a small ODD to a few
minutes for The TEI Stylesheets and the TEI P5 source ( To save the schema as a file, right-click the Transforming with XSLTTransform with XSLT… runs a stylesheet on the current document. With a stylesheet open, it asks for the document to run it on. The result opens beside the document, or is written to a file. You'll find the command in the Command Palette and on the right-click menu of XML and XSLT files. Open XSLT Preview to the Side (the preview button at the top right of the editor) shows the result next to the document, and updates it as you edit the document or the stylesheet. HTML results are shown as a page, with scripts turned off. Other results are shown as text. The extension picks the stylesheet in this order:
Save transforms in the workspace's
Leave out
Settings
Limitations
Reporting problemsPlease open an issue on GitHub with the document and schema (or a small part of them) that show the problem. To build the extension yourself, see CONTRIBUTING.md. LicenseMPL-2.0. The bundled TEI Stylesheets and TEI P5 source keep their own licenses; see extension/tei-stylesheets/README.md. |
