Works on this device. File exports run online.
XPath & XSLT Tester
Paste your XML, type an XPath expression and see each node it selects with its place in the document, or paste an XSLT stylesheet to transform the XML. Your browser runs XPath 1.0 and XSLT 1.0 at once; for XPath 2.0 and 3.1, or to check a stylesheet line by line, run it on the Toolvito server.
Test XPath
Run an XSLT stylesheet on the XML above
How to test XPath
- Paste the XML (or keep the sample).
- Type the expression, for example //book[@year > 2000]/title.
- Read the nodes found, or the number, text or true/false the expression gives.
Namespaces
Prefixes declared in the XML can be used directly. Elements in a default namespace (xmlns="…") need a prefix in XPath 1.0: use d:, for example //d:item.
XSLT
- Browsers run XSLT 1.0 with XPath 1.0. Stylesheets that need XSLT 2.0 or 3.0 (xsl:function, for-each-group, regex functions) fail; the page says so.
- The result is shown as text and is never run as a page.
XPath 2.0 and 3.1 and stylesheet checks on the server
- Under XPath and XSLT on the server, choose what to do: XPath (1.0, 2.0 or 3.1), XSLT 1.0 on the XML above, or a check of the stylesheet.
- Select Run on the server. The XML, the expression and the stylesheet from the boxes above are sent.
- XPath 2.0 and 3.1 give sequences, maps and arrays, with the type of every value (for example xs:double or xs:date) and the place of every node.
- The check compiles the stylesheet and lists each error with its line, and every template with its match, name and mode.
Safety rules (in the browser and on the server)
- A document that declares entities (<!ENTITY …>) is refused, so entity expansion attacks cannot work. A DTD is never loaded.
- A stylesheet cannot read or write other files: xsl:import, xsl:include, document() and extension elements such as exsl:document are refused.
- On the server, the XPath 3.1 functions that read files, web addresses or environment variables (fn:doc, fn:unparsed-text, fn:json-doc, fn:collection, fn:environment-variable) are turned off, nothing is fetched, and no extension functions exist.
- Each server run is stopped when it passes its time limit (2 seconds unless you choose up to 10; an XSLT run within 3 more seconds) and may use at most 1 GB of memory.
- XSLT 2.0 and 3.0 need Saxon, which is not installed on this server: stylesheets that say version 2.0 or 3.0 run as XSLT 1.0 in forwards-compatible mode.