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)INCITS/ISO/IEC 19757-3:20062008 ii ITIC 2008 All rights reserved PDF
2、disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be printed or 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, part
3、ies accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat accepts no liability 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
4、to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitable 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
5、 INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date of ANSI Approval: 7/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).
6、All rights reserved. These materials are subject to copyright claims of International Standardization Organization (ISO), International Electrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Technology Industry Council (ITI). Not for resale. No part of this
7、publication may be reproduced in any form, including an electronic retrieval system, without the prior written permission of ITI. 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 iiiContents Forewor
8、d 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 extends element. 55.4.4 include element. 55.
9、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.1 diagnostic element. 95.5.2 diagnostics e
10、lement. 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 Semantics. 116.1 Validation Function 116.
11、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 reservediv Annex A (normative) RELAX NG schema for Schematron. 15Annex B (norma
12、tive) Schematron Schema for Additional Constraints 19Annex C (normative) Default Query 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
13、 F (normative) Use of Schematron as a Vocabulary 28Annex G (informative) Use of Schematron for Multi-Lingual Schemas. 29Bibliography 30INCITS/ISO/IEC 19757-3:20062008 ITIC 2008 All rights reservedvForeword ISO (the International Organization for Standardization) and IEC (the International Electrotec
14、hnical 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 a
15、ctivity. 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 co
16、mmittee, 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 circulate
17、d 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 resp
18、onsible 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. ISO/IEC 19757 consists of the following parts, under the general title Informatio
19、n 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 Language NVDL The following parts are under preparation: Part 5: Datatypes Part 6: Path
20、-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/IEC 19757-3:20062008 ITIC 2008 All rights reservedvi Introduction ISO/IEC 19757 defi
21、nes a set of Document Schema Definition Languages (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
22、expression of the constraints to be placed on 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 W
23、orld Wide WebConsortium (W3C) and the Organization 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 specif
24、ied constraints in structure and content relieves 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
25、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 asingle extensible framework that allows technologies to work in series or in
26、parallel to produce a single or a set ofvalidation 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 informatio
27、n. Bringing together information within a single 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
28、allows different validationtechnologies 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 spec
29、ify when a document isvalid with respect to an 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 th
30、e ISO Schematron schema for constraints in ISOSchematron 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
31、ISO Schematron schema for a simple XML language 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 inform
32、ative annex with a simple example of a multi-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 group
33、ing assertions.Considered theoretically, a Schematron 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 implemen
34、tation.Considered analytically, Schematron has 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
35、 is based on the Schematron1assertion language. 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 197
36、57-3:20062008 ITIC 2008 All rights reservedAMERICAN NATIONAL STANDARD INCITS/ISO/IEC 19757-3:200620081Information technology Document Schema Definition Languages (DSDL) Part 3: Rule-based validation Schematron 1 ScopeThis part of ISO/IEC 19757 specifies Schematron, a schema language for XML. This pa
37、rt of ISO/IEC 19757 establishesrequirements for Schematron schemas and specifies when an XML document matches the patterns specified by aSchematron schema.2 Normative referencesThe following referenced documents are indispensable for the application of this document. For dated references,only the ed
38、ition cited applies. For undated references, the latest edition of the referenced document (including anyamendments) 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 t
39、he 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 Recommendation, 16 November 1999XSLT, XSL Transformations (XSLT) Version 1.0, W3C Recommendation, 16 November 19993 Terms and defini
40、tionsFor 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 abstract rulecollection of assertions which can be included in other rules but which does not fire itself3.3 active patternpattern be
41、longing to the active phase3.4 active phaseone particular phase, whose patterns are used for validation3.5 assertionnatural-language assertion with corresponding assertion test and ancillary attributes: assertions are marked upwith assert and report elements ITIC 2008 All rights reserved3.6 assertio
42、n testassertion 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
43、 expected 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 constra
44、ints 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 pat
45、tern; 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 with
46、 particular meanings3.16 progressive validationvalidation of constraints in stages determined or grouped to some extent by the schema author rather than, forexample, entirely determined by document order3.17 query language bindingnamed set, specified in a document called a Query Language Binding, of
47、 the languages and conventions used forassertion tests, rule-context expressions and so on, by a particular Schematron implementationNOTE 1 Schematron is defined as a framework, with a default query language binding, but other query language bindings arepossible.NOTE 2 6.4 specifies the information
48、to be required by a query language binding and Annex C defines the default query languagebinding for Schematron.2INCITS/ISO/IEC 19757-3:20062008 ITIC 2008 All rights reserved3.18 ruleunordered collection of assertions with a rule-context expression and ancillary attributes3.19 rule contextelement or
49、 other information item used for assertion tests; a rule is said to fire when an information item matches therule context3.20 rule-context expressiona query to specify subjects; a rule-context is said to match an information item when that information item has notbeen matched by any lexically-previous rule context expressions in the same pattern and the information item is oneof the information items that the query would specify3.21 schemaspecification of a set of XML documents3.22 subje