VS Code Extensions
S

Schematron Syntax

by Fevikler

Syntax highlighting for Schematron validation schema files (.sch)

Downloads

15

Rating

— (0)

Version

0.1.0

Last updated

May 20, 2026

Syntax highlighting for Schematron validation schema files (.sch).

Features

  • Highlights all Schematron elements: schema, pattern, rule, assert, report, ns, let, value-of, phase, include, and more
  • Full XPath syntax highlighting inside test, context, select, path, and value attributes:
    • Functions (normalize-space, count, not, matches, distinct-values, …)
    • Axes (child::, ancestor-or-self::, descendant::, …)
    • Keywords and operators (and, or, div, eq, ne, instance of, …)
    • Types (xs:string, xs:integer, xs:date, …)
    • Variables ($varname)
    • String literals and predicates ([position()=1])
  • Highlights Schematron-specific attributes (id, queryBinding, prefix, uri, role, flag, …) separately from generic XML attributes
  • Standard XML support: comments, CDATA, processing instructions, entity references, namespace prefixes
  • Auto-closing pairs for <>, (), [], '', ""
  • Block comment toggling with <!-- -->

Example

<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <ns prefix="ex" uri="urn:example"/>

  <pattern id="MY_PATTERN">
    <rule context="ex:Invoice/ex:LineItem">
      <assert test="count(ex:Quantity) = 1">
        Each line item must have exactly one quantity.
      </assert>
      <report test="xs:decimal(ex:Amount) &lt; 0">
        Amount must not be negative.
      </report>
    </rule>
  </pattern>
</schema>

Supported File Extensions

Extension Description
.sch Schematron schema

Schematron Standards

This extension supports Schematron as defined in:

  • ISO/IEC 19757-3 (DSDL Schematron)
  • Namespace http://purl.oclc.org/dsdl/schematron
  • XPath 1.0 and XPath 2.0 / XSLT 2.0 query bindings

Related extensions