1、INCITS/ISO/IEC 19757-3:20062008 (ISO/IEC 19757-3:2006, IDT) Information technology Document Schema DefinitionLanguages (DSDL) Part 3: Rule-based validation SchematronINCITS/ISO/IEC 19757-3:20062008(INCITS/ISO/IEC 19757-3:2006, IDT)Copyright American National Standards Institute Provided by IHS under
2、 license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-INCITS/ISO/IEC 19757-3:20062008 ii ITIC 2008 All rights reserved PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be printed or
3、viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat accepts no liability
4、 in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitab
5、le for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below. Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date of ANSI Approval: 7
6、/1/2008 Published by American National Standards Institute, 25 West 43rd Street, New York, New York 10036 Copyright 2008 by Information Technology Industry Council (ITI). All rights reserved. These materials are subject to copyright claims of International Standardization Organization (ISO), Interna
7、tional Electrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Technology Industry Council (ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, without the prior written permission of ITI.
8、 All requests pertaining to this standard should be submitted to ITI, 1250 Eye Street NW, Washington, DC 20005. Printed in the United States of America Copyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted withou
9、t license from IHS-,-,-iiiContents Foreword vIntroduction vi1 Scope 12 Normative references 13 Terms and definitions 14 Notation. 34.1 XPath. 34.2 Predicate Logic 35 Syntax. 45.1 Well-formedness 45.2 Namespace. 45.3 Whitespace. 45.4 Core Elements 45.4.1 active element 45.4.2 assert element 45.4.3 ex
10、tends element. 55.4.4 include element. 55.4.5 let element 55.4.6 name element 55.4.7 ns element 55.4.8 param element 65.4.9 pattern element. 65.4.10 phase element 85.4.11 report element 85.4.12 rule element 85.4.13 schema element 85.4.14 value-of element. 95.5 Ancillary Elements and Attributes 95.5.
11、1 diagnostic element. 95.5.2 diagnostics element. 95.5.3 dir element 95.5.4 emph element 95.5.5 flag attribute. 95.5.6 fpi attribute. 105.5.7 icon attribute. 105.5.8 p element 105.5.9 role attribute. 105.5.10 see attribute. 105.5.11 span element 105.5.12 subject attribute. 105.5.13 title element 106
12、 Semantics. 116.1 Validation Function 116.2 Minimal Syntax. 116.3 Schema Semantics 126.4 Query Language Binding 126.5 Order and side-effects. 137 Conformance 147.1 Simple Conformance. 147.2 Full Conformance. 14INCITS/ISO/IEC 19757-3:20062008 ITIC 2008 All rights reservedCopyright American National S
13、tandards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-iv Annex A (normative) RELAX NG schema for Schematron. 15Annex B (normative) Schematron Schema for Additional Constraints 19Annex C (normative) Default Query
14、Language Binding. 21Annex D (informative) Schematron Validation Report Language 22D.1 Description. 22D.2 RELAX NG Compact Syntax Schema. 22D.3 Schematron Schema 23Annex E (informative) Design Requirements. 27Annex F (normative) Use of Schematron as a Vocabulary 28Annex G (informative) Use of Schemat
15、ron for Multi-Lingual Schemas. 29Bibliography 30INCITS/ISO/IEC 19757-3:20062008 ITIC 2008 All rights reservedCopyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-vForeword ISO (the I
16、nternational 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 esta
17、blished 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 th
18、e 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.
19、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 t
20、his 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 language
21、s. ISO/IEC 19757 consists of the following parts, under the general title Information technology Document Schema Definition Languages (DSDL): Part 1: Overview Part 2: Regular-grammar-based validation RELAX NG Part 3: Rule-based validation Schematron Part 4: Namespace-based Validation Dispatching Lan
22、guage NVDL The following parts are under preparation: Part 5: Datatypes Part 6: Path-based integrity constraints Part 7: Character repertoire description language CRDL Part 8: Document schema renaming language DSRL Part 9: Datatype- and namespace-aware DTDs Part 10: Validation management INCITS/ISO/
23、IEC 19757-3:20062008 ITIC 2008 All rights reservedCopyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-vi Introduction ISO/IEC 19757 defines a set of Document Schema Definition Langu
24、ages (DSDL) that can be used to specify one ormore validation processes performed against Extensible Markup Language (XML) or Standard Generalized MarkupLanguage (SGML) documents. (XML is an application profile SGML, ISO 8879:1986.)A document model is an expression of the constraints to be placed on
25、 the structure and content of documents to bevalidated with the model. A number of technologies have been developed through various formal and informal consortiasince the development of Document Type Definitions (DTD) as part of ISO 8879, notably by the World Wide WebConsortium (W3C) and the Organiz
26、ation for the Advancement of Structured Information Standards (OASIS). A numberof validation technologies are standardized in DSDL to complement those already available as standards or fromindustry.To validate that a structured document conforms to specified constraints in structure and content reli
27、eves the potentiallymany applications acting on the document from having to duplicate the task of confirming that such requirementshave been met. Historically, such tasks and expressions have been developed and utilized in isolation, withoutconsideration of how the features and functionality availab
28、le 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 asingle extensible framework that allows technologies to work in series or in parallel to produce a single or a set ofvalid
29、ation 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 differentportions of their information. Bringing together information within a sin
30、gle XML document sometimes prevents existingdocument models from being used to validate sections of data. By providing an integrated suite of constraint descriptionlanguages that can be applied to different subsets of a single XML document, ISO/IEC 19757 allows different validationtechnologies to be
31、 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 isvalid with respect to a
32、n ISO Schematron schema. Clause 7 describes conformance requirements for implementationsof ISO Schematron validators. Annex A is a normative annex providing the ISO/IEC 19757-2 (RELAX NG) schemafor ISO Schematron. Annex B is a normative annex providing the ISO Schematron schema for constraints in IS
33、OSchematron that cannot be expressed by the schema of Annex A. Annex C is a normative annex providing the defaultquery language binding to XSLT. Annex D is an informative annex providing a ISO/IEC 19757-2 (RELAX NGcompact syntax) schema and corresponding ISO Schematron schema for a simple XML langua
34、ge SchematronValidation Report Language. Annex E is an informative annex providing motivating design requirements for ISOSchematron. Annex F is a normative annex allowing certain Schematron elements to be used in externalvocabularies. Annex G is an informative annex with a simple example of a multi-
35、lingual schema.Considered as a document type, a Schematron schema contains natural-language assertions concerning a set ofdocuments, marked up with various elements and attributes for testing these natural-language assertions, and forsimplifying and grouping assertions.Considered theoretically, a Sc
36、hematron schema reduces to a non-chaining rule system whose terms are Booleanfunctions invoking an external query language on the instance and other visible XML documents, with syntacticfeatures to reduce specification size and to allow efficient implementation.Considered analytically, Schematron ha
37、s two characteristic high-level abstractions: the pattern and the phase. Theseallow 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 Schematron1assertion languag
38、e. The let element is based on XCSL2.Other features arise from the half-dozen early Open Source implementations of Schematron in diverse programminglanguages and from discussions in electronic forums by Schematron users and implementers.INCITS/ISO/IEC 19757-3:20062008 ITIC 2008 All rights reservedCo
39、pyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-AMERICAN NATIONAL STANDARD INCITS/ISO/IEC 19757-3:200620081Information technology Document Schema Definition Languages (DSDL) Part
40、3: Rule-based validation Schematron 1 ScopeThis part of ISO/IEC 19757 specifies Schematron, a schema language for XML. This part of ISO/IEC 19757 establishesrequirements for Schematron schemas and specifies when an XML document matches the patterns specified by aSchematron schema.2 Normative referen
41、cesThe 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 anyamendments) applies.NOTE Each of the following documents has a unique
42、 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.W3C XML 1.0, Extensible Markup Language (XML) 1.0 (Third Edition), W3C Recommendation, 04 February 2004XPath, XML Path Language (XPath) Version 1.0, W3C Recomm
43、endation, 16 November 1999XSLT, XSL Transformations (XSLT) Version 1.0, W3C Recommendation, 16 November 19993 Terms and definitionsFor the purposes of this document, the following terms and definitions apply.3.1 abstract patternpattern in a rule that has been parameterized to enable reuse3.2 abstrac
44、t rulecollection of assertions which can be included in other rules but which does not fire itself3.3 active patternpattern belonging to the active phase3.4 active phaseone particular phase, whose patterns are used for validation3.5 assertionnatural-language assertion with corresponding assertion te
45、st and ancillary attributes: assertions are marked upwith assert and report elements ITIC 2008 All rights reservedCopyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-3.6 assertion t
46、estassertion modelled or implemented by a Boolean query; an assertion test “succeeds“ or “fails“3.7 correct schemaschema that satisfies all the requirements of this part of ISO/IEC 197573.8 diagnosticnamed natural language statements providing information to end-users of validators concerning the ex
47、pected andactual values together with repair hints3.9 elaborated rule context expressionsingle rule context expression which explicitly disallows items selected by lexically previous rule contexts in the samepattern3.10 good schemacorrect schema with queries which terminate and do not add constraint
48、s to those of the natural-language assertions.NOTE It may not be possible to compute that a schema is good.3.11 implementationimplementation of a Schematron validator3.12 nametoken with no whitespace characters3.13 natural-language assertionnatural-language statement expressing some part of a pattern; a natural-language assertion is “met“ or “unmet“3.14 patternnamed structure in instances specified in a schema by a lexically-ordered collection of rules3.15 phasenamed, unordered collection of patterns; patterns may belong to more than one phase; two names, #ALL and#DEFAULT, are reserved w