Skip to main content
Skip table of contents

Step by step guide to installing the XPath NoteBook

Install NodeJS if it's not already installed

STEP 1: Installing the extension in VS Code

Extensions are managed in the Extensions view (⇧⌘X) of the Side Bar. Type XPath Notebook in the Extensions view search bar and, on the XPath Notebook for Visual Studio Code entry, press the install button.

STEP 2: Create and save a new XPath Notebook

Open the Visual Studio Code command palette (⇧⌘P), and run the New XPath Notebook command. An untitled notebook with a markdown cell and a code cell will be shown, initially the file is untitled with a .xbook file extension.

Save the Notebook file in the usual way (⌘S), keeping the .xbook extension. Note that XPath Notebook output cell values are not saved when the file is saved.

STEP 3: Setup the XPath Source

To set the evaluation context file for a notebook just open an XML or JSON file in Visual Studio Code.

The context-item is the result of evaluating either doc($uri) or json-doc($uri) respectively on the last opened file (excluding notebook files). Here is a summary of the evaluation context:

Definition

Details

Context Item

doc($uri) or json-doc($uri) evaluated with last editor URI arg

Statically known namespaces

for prefixes: array, map, math, xs, xsl

Dynamically known namespaces

from root element of last opened file - if it was XML

Default element namespace

any default namespace on root element of last opened XML file

In-scope variables

$_ for last cell output
variables declared in prolog of executed cells

Static Base URI

the URI of the current XPath Notebook file

Base URI

the URI of the last opened file - if it was XML

STEP 4: Add and execute Notebook cells

Press the '+ Code' or '+ Markdown' buttons to add Code or Markdown cells. To execute a cell, press Ctrl-ENTER on the keyboard or click on the 'execute' button alongside the cell. When a Code cell is executed the result is shown in the Output cell immediately below the current cell.

For XPath Notebooks the default Output Cell type is JSON text. This allows XPath maps, arrays and sequences to be represented in an intuitive way.

STEP 5: Save the XPath Notebook when done

Use the CMD-S keyboard shortcut to save an XPath Notebook so it can be used again. Currently, the Output cell details are not saved.

References

How to install Node for you platform | Node.js (nodejs.org)

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.