Information technology - Document Schema Definition Languages (DSDL) - Part 3: Rule-based validation - Schematron

ISO/IEC 19757-3:2016 specifies Schematron, a schema language for XML. This part of ISO/IEC 19757 establishes requirements for Schematron schemas and specifies when an XML document matches the patterns specified by a Schematron schema.

Technologies de l'information — Langages de définition de schéma de documents (DSDL) — Partie 3: Validation de règles orientées — Schematron

General Information

Status
Withdrawn
Publication Date
13-Jan-2016
Withdrawal Date
13-Jan-2016
Current Stage
9599 - Withdrawal of International Standard
Start Date
03-Jun-2020
Completion Date
30-Oct-2025
Ref Project

Relations

Standard
ISO/IEC 19757-3:2016 - Information technology -- Document Schema Definition Languages (DSDL)
English language
36 pages
sale 15% off
Preview
sale 15% off
Preview
Standard
ISO/IEC 19757-3:2016 - Information technology -- Document Schema Definition Languages (DSDL)
English language
36 pages
sale 15% off
Preview
sale 15% off
Preview

Frequently Asked Questions

ISO/IEC 19757-3:2016 is a standard published by the International Organization for Standardization (ISO). Its full title is "Information technology - Document Schema Definition Languages (DSDL) - Part 3: Rule-based validation - Schematron". This standard covers: ISO/IEC 19757-3:2016 specifies Schematron, a schema language for XML. This part of ISO/IEC 19757 establishes requirements for Schematron schemas and specifies when an XML document matches the patterns specified by a Schematron schema.

ISO/IEC 19757-3:2016 specifies Schematron, a schema language for XML. This part of ISO/IEC 19757 establishes requirements for Schematron schemas and specifies when an XML document matches the patterns specified by a Schematron schema.

ISO/IEC 19757-3:2016 is classified under the following ICS (International Classification for Standards) categories: 35.240.30 - IT applications in information, documentation and publishing. The ICS classification helps identify the subject area and facilitates finding related standards.

ISO/IEC 19757-3:2016 has the following relationships with other standards: It is inter standard links to ISO/IEC 19757-3:2020, ISO/IEC 19757-3:2006. Understanding these relationships helps ensure you are using the most current and applicable version of the standard.

You can purchase ISO/IEC 19757-3:2016 directly from iTeh Standards. The document is available in PDF format and is delivered instantly after payment. Add the standard to your cart and complete the secure checkout process. iTeh Standards is an authorized distributor of ISO standards.

Standards Content (Sample)


INTERNATIONAL ISO/IEC
STANDARD 19757-3
Second edition
2016-01-15
Information technology — Document
Schema Definition Languages
(DSDL) —
Part 3:
Rule-based validation — Schematron
Technologies de l’information — Langages de définition de schéma de
documents (DSDL) —
Partie 3: Validation de règles orientées — Schematron
Reference number
©
ISO/IEC 2016
© ISO/IEC 2016, Published in Switzerland
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form
or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior
written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of
the requester.
ISO copyright office
Ch. de Blandonnet 8 • CP 401
CH-1214 Vernier, Geneva, Switzerland
Tel. +41 22 749 01 11
Fax +41 22 749 09 47
copyright@iso.org
www.iso.org
ii © ISO/IEC 2016 – All rights reserved

Contents Page
Foreword .v
Introduction .vi
1 Scope . 1
2 Normative references . 1
3 Terms and definitions . 1
4 Notation . 4
5 Syntax . 4
5.1 Well-formedness. 4
5.2 Namespace. 4
5.3 Whitespace . 4
5.4 Core elements . 4
5.4.1 active element . 4
5.4.2 assert element . 4
5.4.3 extends element . 5
5.4.4 include element . 5
5.4.5 let element. 5
5.4.6 name element . 5
5.4.7 ns element . 6
5.4.8 param element . 6
5.4.9 pattern element . 6
5.4.10 phase element . 6
5.4.11 report element . 6
5.4.12 rule element . 7
5.4.13 schema element . 7
5.4.14 value-of element . . 7
5.5 Ancillary elements and attributes . 8
5.5.1 diagnostic element . 8
5.5.2 diagnostics element . 8
5.5.3 dir element. 8
5.5.4 emph element . 8
5.5.5 flag attribute . 8
5.5.6 fpi attribute . 8
5.5.7 icon attribute . 8
5.5.8 p element . 8
5.5.9 properties element . 8
5.5.10 property element . . 9
5.5.11 role attribute . 9
5.5.12 see attribute . 9
5.5.13 span element . 9
5.5.14 subject attribute . 9
5.5.15 title element . 9
6 Semantics . 9
6.1 Validation function . 9
6.2 Minimal syntax .10
6.3 Abstract pattern processing .10
6.4 Query language binding .12
6.5 Order and side-effects .13
7 Conformance .13
7.1 Simple conformance .13
7.2 Full conformance.13
Annex A (normative) RELAX NG schema for Schematron .15
© ISO/IEC 2016 – All rights reserved iii

Annex B (normative) Schematron schema for additional constraints .19
Annex C (normative) Default query language binding .20
Annex D (informative) Schematron Validation Report Language .21
Annex E (informative) Design requirements .26
Annex F (informative) Use of Schematron as a vocabulary .27
Annex G (informative) Use of Schematron for multi-lingual schemas .28
Annex H (normative) Query language binding for XSLT 2 .29
Annex I (informative) Query language binding for XPath 2 .31
Annex J (informative) Query language binding for EXSLT .32
Annex K (informative) Query language binding for STX .33
Annex L (informative) Example usage of Schematron properties .34
Bibliography .36
iv © ISO/IEC 2016 – All rights reserved

Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission) form the specialized system for worldwide standardization. National bodies that are
members of ISO or IEC participate in the development of International Standards through technical
committees established by the respective organization to deal with particular fields of technical
activity. ISO and IEC technical committees collaborate in fields of mutual interest. Other international
organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the
work. In the field of information technology, ISO and IEC have established a joint technical committee,
ISO/IEC JTC 1.
The procedures used to develop this document and those intended for its further maintenance are
described in the ISO/IEC Directives, Part 1. In particular the different approval criteria needed for
the different types of document should be noted. This document was drafted in accordance with the
editorial rules of the ISO/IEC Directives, Part 2 (see www.iso.org/directives).
Attention is drawn to the possibility that some of the elements of this document may be the subject
of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent
rights. Details of any patent rights identified during the development of the document will be in the
Introduction and/or on the ISO list of patent declarations received (see www.iso.org/patents).
Any trade name used in this document is information given for the convenience of users and does not
constitute an endorsement.
For an explanation on the meaning of ISO specific terms and expressions related to conformity
assessment, as well as information about ISO’s adherence to the WTO principles in the Technical
Barriers to Trade (TBT) see the following URL: Foreword - Supplementary information
The committee responsible for this document is ISO/IEC JTC 1, Information technology, Subcommittee
SC 34, Document description and processing languages.
This second edition cancels and replaces the first edition (ISO/IEC 19757-3:2006), which has been
technically revised.
ISO/IEC 19757 consists of the following parts, under the general title Information technology —
Document Schema Definition Languages (DSDL):
— Part 2: Regular-grammar-based validation — RELAX NG
— Part 3: Rule-based validation — Schematron
— Part 4: Namespace-based Validation Dispatching Language (NVDL)
— Part 5: Extensible Datatypes
— Part 7: Character Repertoire Description Language (CREPDL)
— Part 8: Document Semantics Renaming Language (DSRL)
— Part 9: Namespace and datatype declaration in Document Type Definitions (DTDs)
— Part 11: Schema association
© ISO/IEC 2016 – All rights reserved v

Introduction
ISO/IEC 19757 defines a set of Document Schema Definition Languages (DSDL) that can be used to specify
one or more validation processes performed against Extensible Stylesheet Language (XML) or Standard
Generalized Markup Language (SGML) documents. [XML is an application profile SGML (see ISO 8879).]
A document model is an expression of the constraints to be placed on the structure and content of
documents to be validated with the model. A number of technologies have been developed through
various formal and informal consortia since the development of Document Type Definitions (DTDs)
as part of ISO 8879, notably by the World Wide Web Consortium (W3C) and the Organization for the
Advancement of Structured Information Standards (OASIS). A number of validation technologies are
standardized in DSDL to complement those already available as standards or from industry.
To validate that a structured document conforms to specified constraints in structure and content
relieves the potentially many applications acting on the document from having to duplicate the task
of confirming that such requirements have been met. Historically, such tasks and expressions have
been developed and utilized in isolation, without consideration of how the features and functionality
available in other technologies might enhance validation objectives.
The main objective of ISO/IEC 19757 is to bring together different validation-related tasks and
expressions to form a single extensible framework that allows technologies to work in series or in
parallel to produce a single or a set of validation results. The extensibility of DSDL accommodates
validation technologies not yet designed or specified.
In the past, different design and use criteria have led users to choose different validation technologies
for different portions of their information. Bringing together information within a single XML
document sometimes prevents existing document models from being used to validate sections of data.
By providing an integrated suite of constraint description languages that can be applied to different
subsets of a single XML document, ISO/IEC 19757 allows different validation technologies to be
integrated under a well-defined validation policy.
The structure of this part of ISO/IEC 19757 is as follows. Clause 5 describes the syntax of an ISO
Schematron schema. Clause 6 describes the semantics of a correct ISO Schematron schema; the
semantics specify when a document is valid with respect to an ISO Schematron schema. Clause 7
describes conformance requirements for implementations of ISO Schematron validators. Annex A is a
normative annex providing the ISO/IEC 19757-2 (RELAX NG) schema for ISO Schematron. Annex B is a
normative annex providing the ISO Schematron schema for constraints in ISO Schematron that cannot
be expressed by the schema of Annex A. Annex C is a normative annex providing the default query
language binding to XSLT1. Annex D is a non-normative annex providing an ISO/IEC 19757-2 (RELAX
NG compact syntax) schema and corresponding ISO Schematron schema for a simple XML language
Schematron Validation Report Language. Annex E is a non-normative annex providing motivating
design requirements for ISO Schematron. Annex F is a normative annex allowing certain Schematron
elements to be used in external vocabularies. Annex G is a non-normative annex with a simple example
of a multi-lingual schema.
This edition is backwards compatible with ISO/IEC 19757-3:2006, supercedes it, and augments it with
the following capabilities: patterns may validate different documents, the inclusion mechanism has been
supplemented by an enhanced extension mechanism, assertions may have linked properties, and SVRL
may take richer text. As well, this edition provides extra query language bindings, in particular for XSLT2.
Considered as a document type, a Schematron schema contains natural-language assertions concerning
a set of documents, marked up with various elements and attributes for testing these natural-language
assertions, and for simplifying and grouping assertions.
Considered theoretically, a Schematron schema reduces to a non-chaining rule system whose terms
are Boolean functions invoking an external query language on the instance and other visible XML
documents, with syntactic features to reduce specification size and to allow efficient implementation.
vi © ISO/IEC 2016 – All rights reserved

Considered analytically, Schematron has two characteristic high-level abstractions: the pattern and the
phase. These allow the representation of non-regular, non-sequential constraints that ISO/IEC 19757-2
cannot specify and various dynamic or contingent constraints.
[2]
This part of ISO/IEC 19757 is based on the Schematron assertion language. The let element is based
[4]
on XCSL. Other features arise from the half-dozen early Open Source implementations of Schematron
in diverse programming languages and from discussions in electronic forums by Schematron users and
implementers.
© ISO/IEC 2016 – All rights reserved vii

INTERNATIONAL STANDARD ISO/IEC 19757-3:2016(E)
Information technology — Document Schema Definition
Languages (DSDL) —
Part 3:
Rule-based validation — Schematron
1 Scope
This part of ISO/IEC 19757 specifies Schematron, a schema language for XML. This part of ISO/IEC 19757
establishes requirements for Schematron schemas and specifies when an XML document matches the
patterns specified by a Schematron schema.
2 Normative references
The following documents, in whole or in part, are normatively referenced in this document and are
indispensable for its application. For dated references, only the edition cited applies. For undated
references, the latest edition of the referenced document (including any amendments) applies.
NOTE Each of the following documents has a unique identifier that is used to cite the document in the text.
The unique identifier consists of the part of the reference up to the first comma.
1)
XPath, XML Path Language (XPath) Version 1.0, W3C Recommendation, 16 November 1999,
2)
XPath2, XML Path Language (XPath) 2.0, W3C Recommendation, 23 January 2007,
XPath2 Functions, XQuery 1.0 and XPath 2.0 Functions and Operators, W3C Recommendation, 23
3)
January 2007,
4)
XSLT1, XSL Transformations (XSLT) Version 1.0, W3C Recommendation, 16 November 1999,
5)
XSLT2, XSL Transformations (XSLT) Version 2.0, W3C Recommendation, 23 January 2007,
3 Terms and definitions
For the purposes of this document, the following terms and definitions apply.
3.1
abstract pattern
pattern in a rule that has been parameterized to enable reuse
3.2
abstract rule
collection of assertions which can be included in other rules but which does not fire itself
1) http://www.w3.org/TR/xpath
2) http://www.w3.org/TR/xpath20/
3) http://www.w3.org/TR/xpath-functions/
4) http://www.w3.org/TR/xslt
5) http://www.w3.org/TR/xslt20/
© ISO/IEC 2016 – All rights reserved 1

3.3
active pattern
pattern belonging to the active phase
3.4
active phase
one particular phase, whose patterns are used for validation
3.5
assertion
natural-language assertion with corresponding assertion test and ancillary attributes: assertions are
marked up with assert and report elements
3.6
assertion test
assertion modelled or implemented by a Boolean query
Note 1 to entry: An assertion test “succeeds” or “fails”.
3.7
compound document
notional instance document which has been divided into the original instance and a number of
subordinate well-formed XML documents
Note 1 to entry: These subordinate documents may also contain schema-like information.
3.8
correct schema
schema that satisfies all the requirements of this part of ISO/IEC 19757
3.9
diagnostic
named natural language statements providing information to end-users of validators concerning the
expected and actual values together with repair hints
3.10
elaborated rule context expression
single rule context expression which explicitly disallows items selected by lexically previous rule
contexts in the same pattern
3.11
good schema
correct schema with queries which terminate and do not add constraints to those of the natural-
language assertions
Note 1 to entry: It may not be possible to compute that a schema is good.
3.12
implementation
implementation of a Schematron validator
3.13
name
token with no whitespace characters
3.14
natural-language assertion
natural-language statement expressing some part of a pattern
Note 1 to entry: A natural-language assertion is “met” or “unmet”.
2 © ISO/IEC 2016 – All rights reserved

3.15
pattern
named structure in instances specified in a schema by a lexically-ordered collection of rules
3.16
phase
named, unordered collection of patterns; patterns may belong to more than one phase; two names,
#ALL and #DEFAULT, are reserved with particular meanings
3.17
progressive validation
validation of constraints in stages determined or grouped to some extent by the schema author rather
than, for example, entirely determined by document order
3.18
property
named data giving additional metadata on an assertion or report
3.19
query language binding
named set, specified in a document called a Query Language Binding, of the languages and conventions
used for assertion tests, rule-context expressions and so on, by a particular Schematron implementation
3.20
rule
unordered collection of assertions with a rule-context expression and ancillary attributes
3.21
rule context
element or other information item used for assertion tests
Note 1 to entry: A rule is said to fire when an information item matches the rule context.
3.22
rule-context expression
query to specify subjects
Note 1 to entry: A rule-context is said to match an information item when that information item has not been
matched by any lexically-previous rule context expressions in the same pattern and the information item is one
of the information items that the query would specify.
3.23
schema
specification of a set of XML documents
3.24
subject
particular information item which corresponds to the object of interest of the natural-language
assertions and typically is matched by the context expression of a rule
3.25
valid with respect to a schema
member of the set of XML documents described by the schema: an instance document is valid if no
assertion tests in fired rules of active patterns fail
3.26
variable
constant value, evaluated within the parent schema, phase, pattern or rule and scoped within the
parent schema, phase, pattern or rule
© ISO/IEC 2016 – All rights reserved 3

4 Notation
This part of ISO/IEC 19757 uses XPath to identify information items in Schematron schemas.
5 Syntax
5.1 Well-formedness
A Schematron schema shall be a well-formed XML document, according to the version of XML used.
5.2 Namespace
All elements shown in the grammar for Schematron are qualified with the namespace URI [IRI]:
http://purl.oclc.org/dsdl/schematron
In subsequent clauses, the prefix sch is taken as bound to the Schematron namespace URI for exposition
purposes. The prefix sch is not reserved or required by this part of ISO/IEC 19757. Any element can also
have foreign attributes in addition to the attributes shown in the grammar. A foreign attribute is an
attribute with a name whose namespace URI is neither the empty string nor the Schematron namespace
URI. Any non-empty element may have foreign child elements in addition to the child elements shown in
the grammar. A foreign element is an element with a name whose namespace URI is not the Schematron
namespace URI. There are no constraints on the relative position of foreign child elements with respect
to other child elements.
5.3 Whitespace
Any element can also have as children strings that consist entirely of whitespace characters, where
a whitespace character is one of U+0020, U+009, U+00D or U+00A. There are no constraints on the
relative position of whitespace string children with respect to child elements.
NOTE Leading and trailing whitespace should be stripped from attributes defined by this part. Whitespace
should be collapsed in elements defined by this part that allow text. Whitespace may be stripped from elements
defined by this part that do not allow text.
5.4 Core elements
The grammar for Schematron elements is given in Annex A.
5.4.1 active element
The required pattern attribute is a reference to a pattern that is active in the current phase.
5.4.2 assert element
An assertion made about the context nodes. The data content is a natural-language assertion. The required
test attribute is an assertion test evaluated in the current context. If the test evaluates positive, the
report succeeds. The optional diagnostics attribute is a reference to further diagnostic information.
The natural-language assertion shall be a positive statement of a constraint.
The icon, see and fpi attributes allow rich interfaces and documentation. They are defined below.
The flag attribute allows more detailed outcomes. It is defined below.
4 © ISO/IEC 2016 – All rights reserved

The role and subject attributes allow explicit identification of some part of a pattern. They are
defined below.
NOTE The natural-language assertion may contain information about actual values in addition to expected
values and may contain diagnostic information. Users should note, however, that the diagnostic element is
provided for such information to encourage clear statement of the natural-language assertion.
5.4.3 extends element
The extends element allows reference to the contents of other declarations. The extends element shall
either have an href attribute or a rule attribute but not both.
Abstract rules are named lists of assertions without a context expression. An extends element with a
rule attribute shall reference an abstract rule. The current rule uses all the assertions from the abstract
rule it extends.
An extends attribute with an href attribute shall reference external declarations. The href attribute
is an IRI reference to an external well-formed XML document or to an element in external well-formed
XML document that is Schematron element of the same type as the parent element of the extends
element. The contents of that referenced element shall be inserted in place of the extends element.
In such a case, the relative position of elements in the post-inclusion document may be to that extent
invalid against the schema for Schematron Annex A; however, other schema constraints such as
containment shall still apply.
NOTE The capability to extend with multiple elements was not part of ISO/IEC 19757-3:2006.
5.4.4 include element
The required href attribute shall be an IRI reference to a well-formed XML document or to an element
in a well-formed XML document.
The referenced element shall be inserted in place of the include element. The referenced element shall
be a type which is allowed by the grammar for Schematron at the location of the include element.
5.4.5 let element
A declaration of a named variable. If the let element is the child of a rule element, the variable is
calculated and scoped to the current rule and context. Otherwise, the variable is calculated with the
context of the instance document root.
The required name attribute is the name of the variable. The value attribute is an expression
evaluated in the current context. If no value attribute is specified, the value of the attribute is the
element content of the let element.
It is an error to reference a variable that has not been defined in the current schema, phase, pattern, or
rule, if the query language binding allows this to be determined reliably. It is an error for a variable to
be multiply defined in the current schema, phase, pattern and rule.
The variable is substituted into assertion tests and other expressions in the same rule before the test
or expression is evaluated. The query language binding specifies which lexical conventions are used to
detect references to variables.
5.4.6 name element
Provides the names of nodes from the instance document to allow clearer assertions and diagnostics.
The optional path attribute is an expression evaluated in the current context that returns a string that
is the name of a node. In the latter case, the name of the node is used.
© ISO/IEC 2016 – All rights reserved 5

5.4.7 ns element
Specification of a namespace prefix and URI. The required prefix attribute is an XML name with no
colon character. The required uri attribute is a namespace URI [IRI].
In an ISO Schematron schema, namespace prefixes in context expressions, assertion tests and other
query expressions should use the namespace bindings provided by this element. Namespace prefixes
should not use the namespace bindings in scope for element and attribute names.
NOTE Because the characters allowed as names may change in versions of XML subsequent to W3C XML
1.0, the ISO/IEC 19757-2 (RELAX NG Compact Syntax) schema for Schematron does not constrain the prefix to
particular characters.
5.4.8 param element
A name-value pair providing parameters for an abstract pattern. The required name attribute is an
XML name with no colon. The required value attribute is a fragment of a query.
5.4.9 pattern element
A structure, simple or complex. A set of rules giving constraints that are in some way related. The id
attribute provides a unique name for the pattern and is required for abstract patterns.
The optional documents attribute provides IRIs of subordinate document the rule contexts are relative
to. If the expression evaluates to more than one IRI, then the pattern is sought in each of the documents.
The documents attribute is evaluated in the context of the original instance document root.
The title and p elements allow rich documentation.
The icon, see and fpi attributes allow rich interfaces and documentation.
When a pattern element has the attribute abstract with a value true, then the pattern defines an
abstract pattern. An abstract pattern shall not have a is-a attribute and shall have an id attribute.
NOTE The documents attribute was not part of ISO/IEC 19757-3:2006.
5.4.10 phase element
A grouping of patterns, to name and declare variations in schemas, for example, to support progressive
validation. The required id attribute is the name of the phase. The element specifies the phase to be
used for validating documents, for example, by user command.
Two names, #ALL and #DEFAULT, have special meanings. The name #ALL is reserved to denote that all
patterns are active. The name #DEFAULT is to denote that the name given in the defaultPhase attribute
on the schema element should be used. If no defaultPhase is specified, then all patterns are active.
The icon, see and fpi attributes allow rich interfaces and documentation.
NOTE The names #ALL and #DEFAULT shall not be used in a Schematron schema. They are for use when
invoking or configuring schema validation, for example, as a command-line parameter.
5.4.11 report element
An assertion made about the context nodes. The data content is a natural-language assertion. The required
test attribute is an assertion test evaluated in the current context. If the test evaluates positive, the
report succeeds. The optional diagnostics attribute is a reference to further diagnostic information.
The natural-language assertion shall be a positive statement of a found pattern or a negative statement
of a constraint.
The icon, see and fpi attributes allow rich interfaces and documentation. They are defined below.
6 © ISO/IEC 2016 – All rights reserved

The flag attribute allows more detailed outcomes. It is defined below.
The role and subject attributes allow explicit identification of some part of a pattern. They are
defined below.
NOTE The natural-language assertion may contain information about actual values in addition to expected
values and may contain diagnostic information. Users should note, however, that the diagnostic element is
provided for such information to encourage clear statement of the natural-language assertion.
5.4.12 rule element
A list of assertions tested within the context specified by the required context attribute. The
context attribute specifies the rule context expression.
The icon, see and fpi attributes allow rich interfaces and documentation.
The flag attribute allows more detailed outcomes. It is defined below.
The role and subject attributes allow explicit identification of some part of a pattern as part of the
validation outcome. They are defined below.
When the rule element has the attribute abstract with a value true, then the rule is an abstract
rule. An abstract rule shall not have a context attribute. An abstract rule is a list of assertions that
will be invoked by other rules belonging to the same pattern using the extends element. Abstract
rules provide a mechanism for reducing schema size.
NOTE It is not an error if a rule never fires in a document. In order to test that a document always has some
context, a new pattern should be created from the context of the document, with an assertion requiring the
element or attribute.
5.4.13 schema element
The top-level element of a Schematron schema.
The optional schemaVersion attribute gives the version of the schema. Its allowed values are not
defined by this part of ISO/IEC 19757 and its use is implementation-dependent.
The optional queryBinding attribute provides the short name of the query language binding in use
The defaultPhase attribute may be used to indicate the phase to use in the absence of explicit user-
supplied information.
The title and p elements allow rich documentation.
The icon, see and fpi attributes allow rich interfaces and documentation.
5.4.14 value-of element
Finds or calculates values from the instance document to allow clearer assertions and diagnostics. The
required select attribute is an expression evaluated in the current context that returns a string.
Variable references in the select attribute are resolved in the scope of the current schema, phase,
pattern and rule.
© ISO/IEC 2016 – All rights reserved 7

5.5 Ancillary elements and attributes
5.5.1 diagnostic element
A natural-language message giving more specific details concerning a failed assertion, such as found
versus expected values and repair hints.
NOTE 1 Diagnostics in multiple languages may be supported by using a different diagnostic element for
each language, with the appropriate xml:lang language attribute, and referencing all the unique identifiers of
the diagnostic elements in the diagnostics attribute of the assertion. Annex G gives a simple example of a
multi-lingual schema.
NOTE 2 Typical values for the role attribute on a diagnostic element might be warning, caution or note.
5.5.2 diagnostics element
A section containing individual diagnostic elements.
5.5.3 dir element
A section of natural-language text with a direction specified by the value attribute. The value ltr
indicates left-to-right text; the value rtl indicates right-to-left text.
5.5.4 emph element
A portion of text that should be rendered with some emphasis.
5.5.5 flag attribute
A Boolean variable with initial value false. A flag is implicitly declared by an assertion or rule having a
flag attribute with that name. The value of a flag becomes true when an assertion with that flag fails or
a rule with that flag fires.
The purpose of flags is to convey state or severity information to a subsequent process.
5.5.6 fpi attribute
A formal public identifier for the schema, phase or other element.
5.5.7 icon attribute
The location of a graphics file containing some visible representation of the severity, significance or
other grouping of the associated element.
5.5.8 p element
A paragraph of natural language text containing maintainer and user information about the parent
element. The schema can nominate paragraphs that should be rendered in a distinct way, keyed with
the class attribute.
5.5.9 properties element
A section containing individual property elements.
NOTE The properties element was not part of ISO/IEC 19757-3:2006.
8 © ISO/IEC 2016 – All rights reserved

5.5.10 property element
An element to declare additional arbitrary properties for the subjects of failed assertions and
successful reports.
The optional scheme element should be an IRI or other public identifier which specifies the notation
used for the metadata value.
NOTE 1 The property element is suitable for linking assertions or reports to actions, to additional metadata,
to datatyping, and to dynamically extracted text related to the subject.
NOTE 2 Where the property value contains elements in a well-known namespace or where the scheme
used is otherwise obvious or unnecessary, the scheme element may be omitted. For example, if the property
element contains an ISO/IEC 19757-7 Character Repertoire Description Language schema, no scheme attribute
is appropriate.
NOTE 3 Properties are defined as assertions in order to associate assertion text with the property. A property
of an assert element typically should be information for validation. A property of a report element typically
should be information for document augmentation (post schema validation information set.)
NOTE 4 The property element was not part of ISO/IEC 19757-3:2006.
5.5.11 role attribute
A name describing the function of the assertion or context node in the pattern. If the assertion has a
subject attribute, then the role labels the arc between the context node and any nodes which match
the path expression given by the subject attribute.
5.5.12 see attribute
The URI [IRI] of external information of interest to maintainers and users of the schema.
5.5.13 span element
A portion of some paragraph that should be rendered in a distinct way, keyed with the class attribute.
5.5.14 subject attribute
A path allowing more precise specification of nodes. The path expression is evaluated in the context of the
context node of the current rule. If no subject attribute is specified, the current subject node may be used.
NOTE The subject attribute is required because the rule context may have been selected for reasons of
convenience or performance, in association with the particular assertion tests. In such cases, the rule context may
not be useful to identify users, and the nodes located by the subject attribute may be more useful. Similarly, it
may not be possible to determine from an assertion test which nodes the assertion test has tested. In such a case,
the nodes located by the subject attribute may be more useful.
5.5.15 title element
A summary of the purpose or role of the schema, pattern or rule for the purpose of documentation or a
rich user interface.
6 Semantics
6.1 Validation function
A general Schematron validator is a function returning “valid”, “invalid” or “error”. The function
notionally performs two steps: transforming the schema into a minimal syntax, then testing the
instance against the minimal syntax.
© ISO/IEC 2016 – All rights reserved 9

A Schematron validator is a function over the following:
— a query language binding;
— a schema document;
— an instance to be validated;
— external XML documents addressed using information in the instance or schema;
— a phase name, or #ALL if all patterns shall be active patterns, or #DEFAULT if the defaultPhase
attribute on the schema element shall be used;
— a list of name-value pairs, if the schema uses external variables.
NOTE This part of ISO/IEC 19757 does not constrain other information provided by an implementation
nor other uses of Schematron schemas. However, it is the intent of this part of ISO/IEC 19757 to support
implementations to provide rich, specific diagnostics customised with values that assist in detecting and
rectifying problems.
6.2 Min
...


DRAFT INTERNATIONAL STANDARD
ISO/IEC DIS 19757-3
ISO/IEC JTC 1/SC 34 Secretariat: JISC
Voting begins on: Voting terminates on:
2014-12-01 2015-03-01
Information technology — Document Schema Definition
Languages (DSDL) —
Part 3:
Rule-based validation — Schematron
Technologies de l’information — Langages de définition de schéma de documents (DSDL) —
Partie 3: Validation de règles orientées — Schematron
ICS: 35.240.30
THIS DOCUMENT IS A DRAFT CIRCULATED
FOR COMMENT AND APPROVAL. IT IS
THEREFORE SUBJECT TO CHANGE AND MAY
NOT BE REFERRED TO AS AN INTERNATIONAL
STANDARD UNTIL PUBLISHED AS SUCH.
IN ADDITION TO THEIR EVALUATION AS
BEING ACCEPTABLE FOR INDUSTRIAL,
TECHNOLOGICAL, COMMERCIAL AND
USER PURPOSES, DRAFT INTERNATIONAL
STANDARDS MAY ON OCCASION HAVE TO
BE CONSIDERED IN THE LIGHT OF THEIR
POTENTIAL TO BECOME STANDARDS TO
WHICH REFERENCE MAY BE MADE IN
Reference number
NATIONAL REGULATIONS.
ISO/IEC DIS 19757-3:2014(E)
RECIPIENTS OF THIS DRAFT ARE INVITED
TO SUBMIT, WITH THEIR COMMENTS,
NOTIFICATION OF ANY RELEVANT PATENT
RIGHTS OF WHICH THEY ARE AWARE AND TO
©
PROVIDE SUPPORTING DOCUMENTATION. ISO/IEC 2014

ISO/IEC DIS 19757-3:2014(E)
Copyright notice
This ISO document is a Draft International Standard and is copyright-protected by ISO. Except as
permitted under the applicable laws of the user’s country, neither this ISO draft nor any extract
from it may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, photocopying, recording or otherwise, without prior written permission being secured.
Requests for permission to reproduce should be addressed to either ISO at the address below or ISO’s
member body in the country of the requester.
ISO copyright office
Case postale 56 • CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Reproduction may be subject to royalty payments or a licensing agreement.
Violators may be prosecuted.
ii © ISO 2014 – All rights reserved

ISO/IEC DIS 19757-3
Contents Page
Foreword . v
Introduction . vi
1 Scope . 1
2 Normative references . 1
3 Terms and definitions . 1
4 Notation . 4
5 Syntax . 4
5.1 Well-formedness . 4
5.2 Namespace . 4
5.3 Whitespace . 4
5.4 Core Elements . 4
5.4.1 active element . 4
5.4.2 assert element . 4
5.4.3 extends element . 5
5.4.4 include element . 5
5.4.5 let element . 5
5.4.6 name element . 6
5.4.7 ns element . 6
5.4.8 param element . 6
5.4.9 pattern element . 6
5.4.10 phase element . 6
5.4.11 report element . 7
5.4.12 rule element . 7
5.4.13 schema element . 7
5.4.14 value-of element . 7
5.5 Ancillary Elements and Attributes . 8
5.5.1 diagnostic element . 8
5.5.2 diagnostics element . 8
5.5.3 dir element . 8
5.5.4 emph element . 8
5.5.5 flag attribute . 8
5.5.6 icon attribute . 8
5.5.7 p element . 8
5.5.8 properties element . 8
5.5.9 property element . 9
5.5.10 role attribute . 9
5.5.11 see attribute . 9
5.5.12 span element . 9
5.5.13 subject attribute . 9
5.5.14 title element . 9
6 Semantics . 10
6.1.1 Validation Function . 10
6.2 Minimal Syntax . 10
6.3 Abstract pattern processing . 11
6.4 Query Language Binding . 12
6.5 Order and side-effects . 13
7 Conformance . 14
7.1 Simple Conformance . 14
© ISO/IEC 2014 – All rights reserved iii

ISO/IEC DIS 19757-3
7.2 Full Conformance .14
Annex A (normative) RELAX NG schema for Schematron .15
Annex B (normative) Schematron Schema for Additional Constraints .19
Annex C (normative) Default Query Language Binding .20
Annex D (informative) Schematron Validation Report Language .21
D.1 Description .21
D.2 RELAX NG Compact Syntax Schema .21
D.3 Schematron Schema .23
Annex E (informative) Design Requirements .27
Annex F (informative) Use of Schematron as a Vocabulary .28
Annex G (informative) Use of Schematron for Multi-Lingual Schemas .29
Annex H (normative) Query Language Binding for XSLT 2 .30
Annex I (informative) Query Language Binding for XPath 2 .32
Annex J (informative) Query Language Binding for EXSLT .33
Annex K (informative) Query Language Binding for STX .34
Annex L (informative) Example usage of Schematron Properties .35
L.1 Running Example.35
L.2 Annotation with controlled vocabulary information .35
L.3 Annotation with static information .35
L.4 Annotation with static structured information .35
L.5 Type annotation with XSD Simple Type .36
L.6 Type annotation with dynamic information .36
L.7 Type annotation with dynamic structured information .36
L.8 Annotation with ISO19757-7 character repertoire reference .36
L.9 SVRL document .36
Bibliography .37

iv © ISO/IEC 2014 – All rights reserved

ISO/IEC DIS 19757-3
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission) form the specialized system for worldwide standardization. National bodies that are members of
ISO or IEC participate in the development of International Standards through technical committees
established by the respective organization to deal with particular fields of technical activity. ISO and IEC
technical committees collaborate in fields of mutual interest. Other international organizations, governmental
and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information
technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.
The main task of the joint technical committee is to prepare International Standards. Draft International
Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as
an International Standard requires approval by at least 75 % of the national bodies casting a vote.
Attention is drawn to the possibility that some of the elements of this document may be the subject of patent
rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
ISO/IEC 19757-3 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 34, Document description and processing languages.
This second edition cancels and replaces the first. edition (ISO/IEC 19757-3:2006), of which has been
technically revised.
ISO/IEC 19757 consists of the following parts, under the general title Information technology — Document
Schema Definition Languages (DSDL):
 Part 2: Regular-grammar-based validation -- RELAX NG
 Part 3: Rule-based validation -- Schematron
 Part 4: Namespace-based Validation Dispatching Language (NVDL)
 Part 5: Extensible Datatypes
 Part 7: Character Repertoire Description Language (CREPDL)
 Part 8: Document Semantics Renaming Language (DSRL)
 Part 9: Namespace and datatype declaration in Document Type Definitions (DTDs)
 Part 11: Schema association
© ISO/IEC 2014 – All rights reserved v

ISO/IEC DIS 19757-3
Introduction
ISO/IEC 19757 defines a set of Document Schema Definition Languages (DSDL) that can be used to specify
one or more validation processes performed against Extensible Stylesheet Language (XML) or Standard
Generalized Markup Language (SGML) documents. (XML is an application profile SGML ISO 8879:1986.)
A document model is an expression of the constraints to be placed on the structure and content of documents
to be validated with the model. A number of technologies have been developed through various formal and
informal consortia since the development of Document Type Definitions (DTDs) as part of ISO 8879, notably
by the World Wide Web Consortium (W3C) and the Organization for the Advancement of Structured
Information Standards (OASIS). A number of validation technologies are standardized in DSDL to
complement those already available as standards or from industry.
To validate that a structured document conforms to specified constraints in structure and content relieves the
potentially many applications acting on the document from having to duplicate the task of confirming that such
requirements have been met. Historically, such tasks and expressions have been developed and utilized in
isolation, without consideration of how the features and functionality available in other technologies might
enhance validation objectives.
The main objective of ISO/IEC 19757 is to bring together different validation-related tasks and expressions to
form a single extensible framework that allows technologies to work in series or in parallel to produce a single
or a set of validation results. The extensibility of DSDL accommodates validation technologies not yet
designed or specified.
In the past, different design and use criteria have led users to choose different validation technologies for
different portions of their information. Bringing together information within a single XML document sometimes
prevents existing document models from being used to validate sections of data. By providing an integrated
suite of constraint description languages that can be applied to different subsets of a single XML document,
ISO/IEC 19757 allows different validation technologies to be integrated under a well-defined validation policy.
The structure of this part of ISO/IEC 19757 is as follows. Clause 5 describes the syntax of an ISO Schematron
schema. Clause 6 describes the semantics of a correct ISO Schematron schema; the semantics specify when
a document is valid with respect to an ISO Schematron schema. Clause 7 describes conformance
requirements for implementations of ISO Schematron validators. Annex A is a normative annex providing the
ISO/IEC 19757-2 (RELAX NG) schema for ISO Schematron. Annex B is a normative annex providing the ISO
Schematron schema for constraints in ISO Schematron that cannot be expressed by the schema of Annex A.
Annex C is a normative annex providing the default query language binding to XSLT1. Annex D is a non-
normative annex providing a ISO/IEC 19757-2 (RELAX NG compact syntax) schema and corresponding ISO
Schematron schema for a simple XML language Schematron Validation Report Language.Annex E is a non-
normative annex providing motivating design requirements for ISO Schematron. Annex F is a normative
annex allowing certain Schematron elements to be used in external vocabularies. Annex G is a non-normative
annex with a simple example of a multi-lingual schema.
This edition is backwards compatible with IS19757-3:2006, supercedes it, and augments it with the following
capabilities: patterns may validate different documents, the inclusion mechanism has been supplemented by
an enhanced extension mechanism, assertions may have linked properties, and SVRL may take richer text.
As well, this edition provides extra query language bindings, in particular for XSLT2.
Considered as a document type, a Schematron schema contains natural-language assertions concerning a
set of documents, marked up with various elements and attributes for testing these natural-language
assertions, and for simplifying and grouping assertions.
Considered theoretically, a Schematron schema reduces to a non-chaining rule system whose terms are
Boolean functions invoking an external query language on the instance and other visible XML documents, with
syntactic features to reduce specification size and to allow efficient implementation.
vi © ISO/IEC 2014 – All rights reserved

ISO/IEC DIS 19757-3
Considered analytically, Schematron has two characteristic high-level abstractions: the pattern and the phase.
These allow the representation of non-regular, non-sequential constraints that Part 2 cannot specify, and
various dynamic or contingent constraints.
This part of ISO/IEC 19757 is based on the Schematron[2] assertion language. The let element is based on
XCSL[4]. Other features arise from the half-dozen early Open Source implementations of Schematron in
diverse programming languages and from discussions in electronic forums by Schematron users and
implementers
© ISO/IEC 2014 – All rights reserved vii

DRAFT INTERNATIONAL STANDARD ISO/IEC DIS 19757-3:2014(E)

Information technology — Document Schema Definition
Languages (DSDL) — Part 3: Rule-based Validation -
Schematron
1 Scope
This part of ISO/IEC 19757 specifies Schematron, a schema language for XML. This part of ISO/IEC 19757
establishes requirements for Schematron schemas and specifies when an XML document matches the
patterns specified by a Schematron schema.
2 Normative references
The following referenced documents are indispensable for the application of this document. For dated
references, only the edition cited applies. For undated references, the latest edition of the referenced
document (including any amendments) applies.
NOTE Each of the following documents has a unique identifier that is used to cite the document in the text. The unique
identifier consists of the part of the reference up to the first comma.

IRI, RFC 3987, IETF Request for Comment, Current version, http://tools.ietf.org/html/rfc3987
W3C XML 1.0, Extensible Markup Language (XML) 1.0 (Fourth Edition), W3C Recommendation, 14 June
2006, http://www.w3.org/TR/2006/PER-xml-20060614/
XPath, XML Path Language (XPath) Version 1.0, W3C Recommendation, 16 November
1999,http://www.w3.org/TR/xpath
XPath2, XML Path Language (XPath) 2.0, W3C Recommendation, 23 January 2007,
http://www.w3.org/TR/xpath20/
XPath2 Functions, XQuery 1.0 and XPath 2.0 Functions and Operators, W3C Recommendation, 23 January
2007, http://www.w3.org/TR/xpath-functions/
XDM, XQuery 1.0 and XPath 2.0 Data Model (XDM), W3C Recommendation, 23 January 2007,
http://www.w3.org/TR/xpath-datamodel/
XSLT1, XSL Transformations (XSLT) Version 1.0, W3C Recommendation, 16 November 1999,
http://www.w3.org/TR/xslt
XSLT2, XSL Transformations (XSLT) Version 2.0, W3C Recommendation, 23 January 2007,
http://www.w3.org/TR/xslt20/
3 Terms and definitions
For the purposes of this document, the following terms and definitions apply:
© ISO/IEC 2014 – All rights reserved 1

ISO/IEC DIS 19757-3
3.1
abstract pattern
pattern in a rule that has been parameterized to enable reuse
3.2
abstract rule
collection of assertions which can be included in other rules but which does not fire itself
3.3
active pattern
pattern belonging to the active phase
3.4
active phase
one particular phase, whose patterns are used for validation
3.5
assertion
natural-language assertion with corresponding assertion test and ancillary attributes: assertions are marked
up with assert and report elements
3.6
assertion test
assertion modelled or implemented by a Boolean query; an assertion test "succeeds" or "fails"
3.7
compound document
a notional instance document which has been divided into the original instance and a number of subordinate
well-formed XML documents. These subordinate documents may also contain schema-like information.
3.8
correct schema
schema that satisfies all the requirements of this part of ISO/IEC 19757
3.9
diagnostic
named natural language statements providing information to end-users of validators concerning the
expected and actual values together with repair hints
3.10
elaborated rule context expression
single rule context expression which explicitly disallows items selected by lexically previous rule contexts in
the same pattern
3.11
good schema
correct schema with queries which terminate and do not add constraints to those of the natural-language
assertions. Note: It may not be possible to compute that a schema is good.
3.12
implementation
implementation of a Schematron validator
3.13
name
token with no whitespace characters
2 © ISO/IEC 2014 – All rights reserved

ISO/IEC DIS 19757-3
3.14
natural-language assertion
natural-language statement expressing some part of a pattern; a natural-language assertion is "met" or
"unmet"
3.15
pattern
named structure in instances specified in a schema by a lexically-ordered collection of rules
3.16
phase
named, unordered collection of patterns; patterns may belong to more than one phase; two names, #ALL and
#DEFAULT, are reserved with particular meanings
3.17
progressive validation
the validation of constraints in stages determined or grouped to some extent by the schema author rather than,
for example, entirely determined by document order
3.18
property
named data giving additional metadata on an assertion or report
3.19
query language binding
named set, specified in a document called a Query Language Binding, of the languages and conventions used
for assertion tests, rule-context expressions and so on, by a particular Schematron implementation.
3.20
rule
unordered collection of assertions with a rule-context expression and ancillary attributes
3.21
rule context
element or other information item used for assertion tests; a rule is said to fire when an information item
matches the rule context
3.22
rule-context expression
a query to specify subjects; a rule-context is said to match an information item when that information item has
not been matched by any lexically-previous rule context expressions in the same pattern and the information
item is one of the information items that the query would specify
3.23
schema
specification of a set of XML documents
3.24
subject
particular information item which corresponds to the object of interest of the natural-language assertions and
typically is matched by the context expression of a rule
3.25
valid with respect to a schema
member of the set of XML documents described by the schema: an instance document is valid if no assertion
tests in fired rules of active patterns fail
© ISO/IEC 2014 – All rights reserved 3

ISO/IEC DIS 19757-3
3.26
variable
constant value, evaluated within the parent schema, phase, pattern or rule and scoped within the parent
schema, phase, pattern or rule
4 Notation
This part of ISO/IEC 19757 uses XPath to identify information items in Schematron schemas.
5 Syntax
5.1 Well-formedness
A Schematron schema shall be a well-formed XML document, according to the version of XML used.
5.2 Namespace
All elements shown in the grammar for Schematron are qualified with the namespace URI [IRI]:

http://purl.oclc.org/dsdl/schematron

In subsequent clauses, the prefix sch is taken as bound to the Schematron namespace URI for exposition
purposes. The prefix sch is not reserved or required by this part of ISO/IEC 19757. Any element can also have
foreign attributes in addition to the attributes shown in the grammar. A foreign attribute is an attribute with a
name whose namespace URI is neither the empty string nor the Schematron namespace URI. Any non-empty
element may have foreign child elements in addition to the child elements shown in the grammar. A foreign
element is an element with a name whose namespace URI is not the Schematron namespace URI. There are
no constraints on the relative position of foreign child elements with respect to other child elements.
5.3 Whitespace
Any element can also have as children strings that consist entirely of whitespace characters, where a
whitespace character is one of U+0020, U+009, U+00D or U+00A. There are no constraints on the relative
position of whitespace string children with respect to child elements.
NOTE Leading and trailing whitespace should be stripped from attributes defined by this part. Whitespace should be
collapsed in elements defined by this part that allow text. Whitespace may be stripped from elements defined by this part
that do not allow text.
5.4 Core Elements
The grammar for Schematron elements is given in Annex A.
5.4.1 active element
The required pattern attribute is a reference to a pattern that is active in the current phase.
5.4.2 assert element
An assertion made about the context nodes. The data content is a natural-language assertion. The required
test attribute is an assertion test evaluated in the current context. If the test evaluates positive, the report
succeeds. The optional diagnostics attribute is a reference to further diagnostic information.
The natural-language assertion shall be a positive statement of a constraint.
4 © ISO/IEC 2014 – All rights reserved

ISO/IEC DIS 19757-3
The icon, see and fpi attributes allow rich interfaces and documentation. They are defined below.
The flag attribute allows more detailed outcomes. It is defined below.
The role and subject attributes allow explicit identification of some part of a pattern. They are defined
below.
NOTE The natural-language assertion may contain information about actual values in addition to expected values
and may contain diagnostic information. Users should note, however, that the diagnostic element is provided for such
information to encourage clear statement of the natural-language assertion.
5.4.3 extends element
The extends element allows reference to the contents of other declarations. The extends element shall either
have an href attribute or a rule attribute but not both.
Abstract rules are named lists of assertions without a context expression. An extends element with a rule
attribute shall reference an abstract rule. The current rule uses all the assertions from the abstract rule it
extends.
An extends attribute with an href attribute shall reference external declarations. The href attribute is an IRI
reference to an external well-formed XML document or to an element in external well-formed XML document
that is Schematron element of the same type as the parent element of the extends element. The contents of
that referenced element shall be inserted in place of the extends element.
In such a case, the relative position of elements in the post-inclusion document may be to that extent invalid
against the schema for Schematron Annex A, however other schema constraints such as containment shall
still apply.
NOTE The capability to extend with multiple elements was not part of IS19757-3:2006.
5.4.4 include element
The required href attribute shall be an IRI reference to a well-formed XML document or to an element in a
well-formed XML document.
The referenced element shall be inserted in place of the include element. The referenced element shall be a
type which is allowed by the grammar for Schematron at the location of the include element.
5.4.5 let element
A declaration of a named variable. If the let element is the child of a rule element, the variable is
calculated and scoped to the current rule and context. Otherwise, the variable is calculated with the context of
the instance document root.
The required name attribute is the name of the variable. The value attribute is an expression evaluated in
the current context. If no value attribute is specified, the value of the attribute is the element content of the
let element.
It is an error to reference a variable that has not been defined in the current schema, phase, pattern, or rule, if
the query language binding allows this to be determined reliably. It is an error for a variable to be multiply
defined in the current schema, phase, pattern and rule.
The variable is substituted into assertion tests and other expressions in the same rule before the test or
expression is evaluated. The query language binding specifies which lexical conventions are used to detect
references to variables.
© ISO/IEC 2014 – All rights reserved 5

ISO/IEC DIS 19757-3
5.4.6 name element
Provides the names of nodes from the instance document to allow clearer assertions and diagnostics. The
optional path attribute is an expression evaluated in the current context that returns a string that is the name
of a node. In the latter case, the name of the node is used.
5.4.7 ns element
Specification of a namespace prefix and URI. The required prefix attribute is an XML name with no colon
character. The required uri attribute is a namespace URI [IRI].
In an ISO Schematron schema, namespace prefixes in context expressions, assertion tests and other query
expressions should use the namespace bindings provided by this element. Namespace prefixes should not
use the namespace bindings in scope for element and attribute names.
NOTE Because the characters allowed as names may change in versions of XML subsequent to W3C XML 1.0, the
ISO/IEC 19757-2 (RELAX NG Compact Syntax) schema for Schematron does not constrain the prefix to particular
characters.
5.4.8 param element
A name-value pair providing parameters for an abstract pattern. The required name attribute is an XML name
with no colon. The required value attribute is a fragment of a query.
5.4.9 pattern element
A structure, simple or complex. A set of rules giving constraints that are in some way related. The id attribute
provides a unique name for the pattern and is required for abstract patterns.
The optional documents attribute provides IRIs of subordinate document the rule contexts are relative to. If the
expression evaluates to more than one IRI, then the pattern is sought in each of the documents. The
documents attribute is evaluated in the context of the original instance document root.
The title and p elements allow rich documentation.
The icon, see and fpi attributes allow rich interfaces and documentation.
When a pattern element has the attribute abstract with a value true, then the pattern defines an
abstract pattern. An abstract pattern shall not have a is-a attribute and shall have an id attribute.
NOTE The documents attribute was not part of IS19757-3:2006.
5.4.10 phase element
A grouping of patterns, to name and declare variations in schemas, for example, to support progressive
validation. The required id attribute is the name of the phase. The element specifies the phase to be used for
validating documents, for example by user command.
Two names, #ALL and #DEFAULT, have special meanings. The name #ALL is reserved to denote that all
patterns are active. The name #DEFAULT is to denote that the name given in the defaultPhase attribute on
the schema element should be used. If no defaultPhase is specified, then all patterns are active.
The icon, see and fpi attributes allow rich interfaces and documentation.
NOTE The names #ALL and #DEFAULT shall not be used in a Schematron schema. They are for use when invoking
or configuring schema validation, for example as a command-line parameter.
6 © ISO/IEC 2014 – All rights reserved

ISO/IEC DIS 19757-3
5.4.11 report element
An assertion made about the context nodes. The data content is a natural-language assertion. The required
test attribute is an assertion test evaluated in the current context. If the test evaluates positive, the report
succeeds. The optional diagnostics attribute is a reference to further diagnostic information.
The natural-language assertion shall be a positive statement of a found pattern or a negative statement of a
constraint.
The icon, see and fpi attributes allow rich interfaces and documentation. They are defined below.
The flag attribute allows more detailed outcomes. It is defined below.
The role and subject attributes allow explicit identification of some part of a pattern. They are defined
below.
NOTE The natural-language assertion may contain information about actual values in addition to expected values
and may contain diagnostic information. Users should note, however, that the diagnostic element is provided for such
information to encourage clear statement of the natural-language assertion.
5.4.12 rule element
A list of assertions tested within the context specified by the required context attribute. The context
attribute specifies the rule context expression.
The icon, see and fpi attributes allow rich interfaces and documentation.
The flag attribute allows more detailed outcomes. It is defined below.
The role and subject attributes allow explicit identification of some part of a pattern as part of the
validation outcome. They are defined below.
When the rule element has the attribute abstract with a value true, then the rule is an abstract rule. An
abstract rule shall not have a context attribute. An abstract rule is a list of assertions that will be invoked by
other rules belonging to the same pattern using the extends element. Abstract rules provide a mechanism
for reducing schema size.
NOTE It is not an error if a rule never fires in a document. In order to test that a document always has some context,
a new pattern should be created from the context of the document, with an assertion requiring the element or attribute.
5.4.13 schema element
The top-level element of a Schematron schema.
The optional schemaVersion attribute gives the version of the schema. Its allowed values are not defined by
this part of ISO/IEC 19757 and its use is implementation-dependent.
The optional queryBinding attribute provides the short name of the query language binding in use The
defaultPhase attribute may be used to indicate the phase to use in the absence of explicit user-supplied
information.
The title and p elements allow rich documentation.
The icon, see and fpi attributes allow rich interfaces and documentation.
5.4.14 value-of element
Finds or calculates values from the instance document to allow clearer assertions and diagnostics. The
required select attribute is an expression evaluated in the current context that returns a string.
© ISO/IEC 2014 – All rights reserved 7

ISO/IEC DIS 19757-3
Variable references in the select attribute are resolved in the scope of the current schema, phase, pattern
and rule.
5.5 Ancillary Elements and Attributes
5.5.1 diagnostic element
A natural-language message giving more specific details concerning a failed assertion, such as found versus
expected values and repair hints.
NOTE Diagnostics in multiple languages may be supported by using a different diagnostic element for each
language, with the appropriate xml:lang language attribute, and referencing all the unique identifiers of the diagnostic
elements in the diagnostics attribute of the assertion. Annex G gives a simple example of a multi-lingual schema.
NOTE Typical values for the role attribute on a diagnostic element might be warning, caution or note.
5.5.2 diagnostics element
A section containing individual diagnostic elements.
5.5.3 dir element
A section of natural-language text with a direction specified by the value attribute. The value ltr indicates
left-to-right text; the value rtl indicates right-to-left text.
5.5.4 emph element
A portion of text that should be rendered with some emphasis.
5.5.5 flag attribute
A Boolean variable with initial value false. A flag is implicitly declared by an assertion or rule having a flag
attribute with that name. The value of a flag becomes true when an assertion with that flag fails or a rule with
that flag fires.
The purpose of flags is to convey state or severity information to a subsequent process. fpi attribute
A formal public identifier for the schema, phase or other element.
5.5.6 icon attribute
The location of a graphics file containing some visible representation of the severity, significance or other
grouping of the associated element.
5.5.7 p element
A paragraph of natural language text containing maintainer and user information about the parent element.
The schema can nominate paragraphs that should be rendered in a distinct way, keyed with the class
attribute.
5.5.8 properties element
A section containing individual property elements.
NOTE The properties element was not part of IS19757-3:2006.
8 © ISO/IEC 2014 – All rights reserved

ISO/IEC DIS 19757-3
5.5.9 property element
An element to declare additional arbitrary properties for the subjects of failed assertions and successful
reports.
The optional scheme element should be an IRI or other public identifier which specifies the notation used for
the metadata value.
NOTE The property element is suitable for linking assertions or reports to actions, to additional metadata, to
datatyping, and to dynamically extracted text related to the subject.
NOTE Where the property value contains elements in a well-known namespace or where the scheme used is
otherwise obvious or unnecessary, the scheme element may be omitted. For example, if the property element contains an
IS19757-7 Character Repertoire Description Language schema, no scheme attribute is appropriate.
NOTE Properties are defined as assertions in order to associate assertion text with the property. A property of an
assert element typically should be information for validation. A property of a report element typically should be information
for document augmentation (post schema validation information set.)
NOTE The property element was not part of IS19757-3:2006.
5.5.10 role attribute
A name describing the function of the assertion or context node in the pattern. If the assertion has a subject
attribute, then the role labels the arc between the context node and any nodes which match the path
expression given by the subject attribute.
5.5.11 see attribute
The URI [IRI] of external information of interest to maintainers and users of the schema.
5.5.12 span element
A portion of some paragraph that should be rendered in a distinct way, keyed with the class attribute.
5.5.13 subject attribute
A path allowing more precise specification of nodes. The path expression is evaluated in the context of the
context node of the current rule. If no subject attribute is specified, the current subject node may be used.
NOTE The subject attribute is required because the rule context may have been selected for reasons of
convenience or performance, in association with the particular assertion tests. In such cases, the rule context may not be
useful to identify users, and the nodes located by the subject attribute may be more useful. Similarly, it may not be
possible to determine from an assertion test which nodes the assertion test has tested. In such a case, the nodes located
by the subject attribute may be more useful.
5.5.14 title element
A summary of the purpose or role of the schema, pattern or rule for the purpose of documentation or a rich
user interface.
© ISO/IEC 2014 – All rights reserved 9

ISO/IEC DIS 19757-3
6 Semantics
6.1.1 Validation Function
A general Schematron validator is a function returning "valid", "invalid" or "error". The function notionally
performs two steps: transforming the schema into a minimal syntax, then testing the instance against the
minimal syntax.
A Schematron validator is a function over the following:
 a query language binding
 a schema document
 an instance to be validated
 external XML documents addressed using information in the instance or schema
 a phase name, or #ALL if all patterns shall be active patterns, or #DEFAULT if the defaultPhase
attribute on the schema element shall be used
 a list of name-value pairs, if the schema uses external variables.
NOTE This part of ISO/IEC 19757 does not constrain other information provided by an implementation nor other uses
of Schematron schemas. However, it is the intent of this part of ISO/IEC 19757 to support implementations to provide rich,
specific diagnostics customised with values that assist in detecting and rectifying problems.
6.2 Minimal Syntax
T
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...