1、BSI Standards Publication BS ISO/IEC 19757-3:2016 Information technology Document Schema Definition Languages (DSDL) Part 3: Rule-based validation SchematronBS ISO/IEC 19757-3:2016 BRITISH STANDARD National foreword This British Standard is the UK implementation of ISO/IEC 19757-3:2016. It supersede
2、s BS ISO/IEC 19757-3:2006 which is withdrawn. The UK participation in its preparation was entrusted to Technical Committee IST/41, Document description and processing language. A list of organizations represented on this committee can be obtained on request to its secretary. This publication does no
3、t purport to include all the necessary provisions of a contract. Users are responsible for its correct application. The British Standards Institution 2016. Published by BSI Standards Limited 2016 ISBN 978 0 580 71314 9 ICS 35.240.30 Compliance with a British Standard cannot confer immunity from lega
4、l obligations. This British Standard was published under the authority of the Standards Policy and Strategy Committee on 31 January 2016. Amendments/corrigenda issued since publication Date T e x t a f f e c t e dBS ISO/IEC 19757-3:2016 Information technology Document Schema Definition Languages (DS
5、DL) Part 3: Rule-based validation Schematron Technologies de linformation Langages de dfinition de schma de documents (DSDL) Partie 3: Validation de rgles orientes Schematron INTERNATIONAL STANDARD ISO/IEC 19757-3 Reference number ISO/IEC 19757-3:2016(E) Second edition 2016-01-15 ISO/IEC 2016 BS ISO
6、/IEC 19757-3:2016ii ISO/IEC 2016 All rights reserved COPYRIGHT PROTECTED DOCUMENT 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, includi
7、ng 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 ISOs member body in the country of the requester. ISO copyright office Ch. de Blandonnet 8 CP 401 CH-1214 Vernier, Geneva, Switzerland Tel
8、. +41 22 749 01 11 Fax +41 22 749 09 47 copyrightiso.org www.iso.org ISO/IEC 19757-3:2016(E)BS ISO/IEC 19757-3:2016ISO/IEC 19757-3:2016(E)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
9、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
10、 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.
11、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 languag
12、e binding .12 6.5 Order and side-effects 13 7 Conformance 13 7.1 Simple conformance 13 7.2 Full conformance13 Annex A (normative) RELAX NG schema for Schematron 15 ISO/IEC 2016 All rights reserved iii Contents PageBS ISO/IEC 19757-3:2016ISO/IEC 19757-3:2016(E)Annex B (normative) Schematron schema fo
13、r 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 mult
14、i-lingual schemas .28 Annex H (normative) Query language binding for XSL T 2 29 Annex I (informative) Query language binding for XPath 2 31 Annex J (informative) Query language binding for EXSL T .32 Annex K (informative) Query language binding for STX .33 Annex L (informative) Example usage of Sche
15、matron properties 34 Bibliography .36 iv ISO/IEC 2016 All rights reservedBS ISO/IEC 19757-3:2016ISO/IEC 19757-3:2016(E) Foreword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization.
16、 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 int
17、erest. 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 thos
18、e 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 ww
19、w.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
20、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 term
21、s and expressions related to conformity assessment, as well as information about ISOs 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 technol
22、ogy, 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
23、 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 R
24、enaming Language (DSRL) Part 9: Namespace and datatype declaration in Document Type Definitions (DTDs) Part 11: Schema association ISO/IEC 2016 All rights reserved vBS ISO/IEC 19757-3:2016ISO/IEC 19757-3:2016(E) Introduction ISO/IEC 19757 defines a set of Document Schema Definition Languages (DSDL)
25、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 st
26、ructure 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 Organizati
27、on 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 reli
28、eves 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 avai
29、lable 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
30、 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 with
31、in 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 technol
32、ogies 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 wit
33、h 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 c
34、onstraints 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 f
35、or 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
36、 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, asse
37、rtions 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 eleme
38、nts 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 X
39、ML documents, with syntactic features to reduce specification size and to allow efficient implementation.vi ISO/IEC 2016 All rights reservedBS ISO/IEC 19757-3:2016ISO/IEC 19757-3:2016(E) Considered analytically, Schematron has two characteristic high-level abstractions: the pattern and the phase. Th
40、ese allow the representation of non-regular, non-sequential constraints that ISO/IEC 19757-2 cannot specify and various dynamic or contingent constraints. This part of ISO/IEC 19757 is based on the Schematron 2assertion language. The let element is based on XCSL. 4Other features arise from the half-
41、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 viiBS ISO/IEC 19757-3:2016BS ISO/IEC 19757-3:2016Information technology Document Schema Definition L
42、anguages (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 sc
43、hema. 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
44、 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. XPath, XML Path Language (XPath) Version 1.0, W3C Recommendation, 16 November 1999, 1)
45、XPath2, XML Path Language (XPath) 2.0, W3C Recommendation, 23 January 2007, 2) XPath2 Functions, XQuery 1.0 and XPath 2.0 Functions and Operators, W3C Recommendation, 23 January 2007 , 3) XSLT1, XSL Transformations (XSLT) Version 1.0, W3C Recommendation, 16 November 1999, 4) XSLT2, XSL Transformatio
46、ns (XSLT) Version 2.0, W3C Recommendation, 23 January 2007, 5) 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
47、 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/ INTERNATIONAL ST ANDARD ISO/IEC 19757-3:2016(E) ISO/IEC 2016 All rights reserved
48、1BS ISO/IEC 19757-3:2016ISO/IEC 19757-3:2016(E) 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 m
49、arked 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 requ