1、raising standards worldwide NO COPYING WITHOUT BSI PERMISSION EXCEPT AS PERMITTED BY COPYRIGHT LAW BSI Standards Publication Information technology Document Schema Definition Languages (DSDL) Part 5: Extensible Datatypes BS ISO/IEC 19757-5:2011National foreword This British Standard is the UK implem
2、entation of ISO/IEC 19757-5:2011. 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 not purport to
3、 include all the necessary provisions of a contract. Users are responsible for its correct application. BSI 2011 ISBN 978 0 580 54613 6 ICS 35.240.30 Compliance with a British Standard cannot confer immunity from legal obligations. This British Standard was published under the authority of the Stand
4、ards Policy and Strategy Committee on 31 October 2011. Amendments issued since publication Amd. No. Date Text affected BRITISH STANDARD BS ISO/IEC 19757-5:2011 Reference number ISO/IEC 19757-5:2011(E) ISO/IEC 2011INTERNATIONAL STANDARD ISO/IEC 19757-5 First edition 2011-10-01 Information technology
5、Document Schema Definition Languages (DSDL) Part 5: Extensible Datatypes Technologies de linformation Langages de dfinition de schma de documents (DSDL) Partie 5: Types de donnes extensibles BS ISO/IEC 19757-5:2011ISO/IEC 19757-5:2011(E) ISO/IEC 2011 All rights reserved iiiContents Page Foreword iv
6、Introduction . v 1 Scope 1 2 Normative references 1 3 Terms and definitions . 2 4 Extensible Datatypes schema overview . 2 5 Common constructs 3 5.1 Common types . 3 5.2 Common attributes 4 5.3 Extension elements . 4 5.4 Versioning and compatibility . 5 6 Simplification . 5 6.1 Include elements . 5
7、6.2 Same-named datatypes 6 7 Document element 7 8 Top-level elements 7 8.1 div element 8 8.2 Top-level extension elements 8 9 Datatype definition 8 9.1 Named datatypes . 8 9.2 Anonymous datatypes 8 9.3 Whitespace processing 9 9.4 Mechanisms for defining datatypes 9 Annex A (normative) RELAX NG schem
8、a for Extensible Datatypes documents . 16 Bibliography 18 BS ISO/IEC 19757-5:2011ISO/IEC 19757-5:2011(E) iv ISO/IEC 2011 All rights reservedForeword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldw
9、ide 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
10、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 draft
11、ed 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 Intern
12、ational 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. IS
13、O/IEC 19757-5 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 Information technology Document Schema Definition Languages (DSDL):
14、 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) Part 5: Extensible Datatypes Part 7: Character Repertoire Description Language (CREPDL) Part 8: Document Semantics Renaming Lang
15、uage (DSRL) Part 9: Namespace and datatype declaration in Document Type Definitions (DTDs) Part 11: Schema Association BS ISO/IEC 19757-5:2011ISO/IEC 19757-5:2011(E) ISO/IEC 2011 All rights reserved vIntroduction This part of ISO/IEC 19757 specifies a powerful, XML-based language which enables users
16、 to create and extend their own libraries of datatypes using straightfoward declarative XML constructs. Such libraries are well-suited to being used in pipelining validation processes in conjunction with other XML schema languages. Unlike W3C Schema 1 , ISO/IEC 19757-2:2008 (RELAX NG) does not itsel
17、f provide a declarative mechanism for users to define their own datatypes. If they are not satisfied with the two built-in types of string and token, RELAX NG users have had either to use a pre-written library bundled with their validator, or to program a datatype library using that validators API.
18、Such programmed datatype libraries are hard to construct for non-programmer users, and built-in datatype libraries are often insufficient for users needs. BS ISO/IEC 19757-5:2011INTERNATIONAL STANDARD ISO/IEC 19757-5:2011(E) ISO/IEC 2011 All rights reserved 1Information technology Document Schema De
19、finition Languages (DSDL) Part 5: Extensible Datatypes 1 Scope This part of ISO/IEC 19757 specifies an XML language that allows users to create and extend datatype libraries for their own purposes. The datatype definitions in these libraries can be used by XML validators and other tools to validate
20、content and make comparisons between values. 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 am
21、endments) applies. IETF RFC 3023, XML Media Types, Internet Standards Track Specification, January 2001, http:/www.ietf.org/rfc/rfc3023.txt IETF RFC 3987, Internationalized Resource Identifiers (IRIs), Internet Standards Track Specification, January 2005, http:/www.ietf.org/rfc/rfc3987.txt ISO/IEC 1
22、9757-2:2008, Information technology Document Schema Definition Language (DSDL) Part 2: Regular-grammar-based validation RELAX NG W3C XML, Extensible Markup Language (XML) 1.0 (Fourth Edition), W3C Recommendation, 16 August 2006, edited in place 29 September 2006, http:/www.w3.org/TR/2006/REC-xml-200
23、60816 W3C XML Names, Namespaces in XML 1.0 (Third Edition), W3C Recommendation, 8 December 2009, http:/www.w3.org/TR/2009/REC-xml-names-20091208/ W3C XPath 2.0, XML Path Language (XPath) 2.0, W3C Recommendation, 23 January 2007, http:/www.w3.org/TR/2007/REC-xpath20-20070123/ W3C XPath 2.0 Functions,
24、 XQuery 1.0 and XPath 2.0 Functions and Operators, W3C Recommendation, 23 January 2007, http:/www.w3.org/TR/2007/REC-xpath-functions-20070123/ W3C XSLT 2.0, XSL Transformations (XSLT) Version 2.0, W3C Recommendation, 23 January 2007, http:/www.w3.org/TR/2007/REC-xslt20-20070123/ W3C XLink 1.0, XML L
25、inking Language (XLink) Version 1.0, W3C Recommendation, 27 June 2001, http:/www.w3.org/TR/2001/REC-xlink-20010627/ BS ISO/IEC 19757-5:2011ISO/IEC 19757-5:2011(E) 2 ISO/IEC 2011 All rights reserved3 Terms and definitions For the purposes of this document, the following terms and definitions apply. 3
26、.1 candidate value some character data in an XML document that is to have its datatype tested 3.2 datatype named property of sequences of character data that validate against datatype definitions as described by this part of ISO/IEC 19757 3.3 datatype definition formal specification of constraints u
27、pon XML character data for the datatype being defined 3.4 datatype library collection of datatype definitions that share the same XML Namespace 3.5 Extensible Datatypes document XML document which is valid to the normative schema presented in this part of ISO/IEC 19757, and which conforms to its pro
28、visions 3.6 forwards-compatible mode operating mode in which an implementation ignores language constructs which are labelled as having a version later than that understood by the implementation, unless they are explicitly labelled as requiring processing 3.7 implementation Extensible Datatypes impl
29、ementation that conforms to this part of ISO/IEC 19757 3.8 extended implementation implementation that conforms to this part of ISO/IEC 19757, and which provides additional functionality provided by the extension mechanisms of Extensible Datatypes 4 Extensible Datatypes schema overview The schema fo
30、r Extensible Datatypes is interspersed as fragments within the narrative text of this part of ISO/IEC 19757 and appears rendered against a grey background. The schema language used is the compact syntax of RELAX NG, as defined by Annex C of ISO/IEC 29500:2008. Concatenating the schema fragments in t
31、his part of ISO/IEC 19757 gives a RELAX NG schema that normatively defines the grammar of Extensible Datatypes. The consolidated schema is shown in Annex A. NOTE 1 Throughout, as per ISO/IEC 19757-2:2008, RELAX NG compact syntax keywords used as identifiers in the schema are prefixed with the “ char
32、acter. NOTE 2 The null Namespace is bound to the prefix “local“ so that it can be referenced later in the schema. default namespace dt = “http:/purl.oclc.org/dsdl/extensible-datatypes“ namespace local = “ BS ISO/IEC 19757-5:2011ISO/IEC 19757-5:2011(E) ISO/IEC 2011 All rights reserved 3Datatype libra
33、ries are defined in ISO/IEC 19757-2:2008 as being identified by an IRI, with each datatype within a given datatype library being identified by a NCName. An Extensible Datatypes document presents one or more such datatype libraries to implementations. Each datatype definition has a qualified name; th
34、e Namespace IRI identifies the datatype library to which the datatype belongs, and the local part identifies the name of the datatype within that datatype library. 5 Common constructs 5.1 Common types 5.1.1 XPath expressions W3C XPath 2.0 expressions are used to bind values to variables or propertie
35、s and to express tests in conditions. Conforming implementations of Extensible Datatypes shall additionally implement the following functions from W3C XSLT 2.0: document (W3C XSLT 2.0, section 16.1) format-number (W3C XSLT 2.0, section 16.4) function-available (W3C XSLT 2.0, section 18.1.1) These fu
36、nctions shall be callable within implementations using unqualified function names. NOTE The function-available function can be used to test for the availability of XPath extension functions for the purposes of enhanced validation in extended implementations. XPath = text The context node for evaluat
37、ing XPath expressions in Extensible Datatypes is a text node that is the only child of a root node, and whose value is the whitespace-normalized candidate value. The context position and context size are both 1. The set of variable bindings are the in-scope variables, as defined at 9.4.1. The set of
38、 namespace declarations that are in-scope for the expression are those that are in-scope for the element on which the XPath is given. 5.1.2 Boolean values Where a boolean value is to be specified, the literal strings “true“ and “false“ are used. boolean = “true“ | “false“ 5.1.3 Regular expressions R
39、egular expressions are defined in W3C XPath 2.0. regular-expression = text 5.1.4 Arbitrary content Extensible Datatypes document are governed by an open schema which, for purposes of extensibility, allows arbitrary content to occur at certain points. Such content can be any XML content other than el
40、ements or attributes associated with the Extensible Datatypes XML Namespace. BS ISO/IEC 19757-5:2011ISO/IEC 19757-5:2011(E) 4 ISO/IEC 2011 All rights reservedanything = mixed element * - dt:* attribute * - dt:* text *, anything * 5.2 Common attributes 5.2.1 version attribute The value of the version
41、 attribute specifies the version of Extensible Datatypes being used within the element on which it occurs. The version described by this International Standard is “1.0“ 5.2.2 ns attribute The value of the ns attribute specifies the Namespace IRI of those datatypes defined within that element whose n
42、ame attribute does not include a prefix, thus determining the datatype library to which these datatypes belong. This value shall be an IRI as defined by IETF RFC 3987. ns = attribute ns text 5.2.3 name attribute The name attribute specifies the name of a datatype, parameter, variable or property. Th
43、e value of a name attribute is a qualified name. If no prefix is specified the Namespace IRI associated with the name depends on the element on which the name attribute occurs. If the name attribute occurs on a datatype element, the Namespace IRI is that given in the ns attribute of the datatype ele
44、ment or its nearest ancestor element that has a ns attribute, if there is one, or no Namespace IRI if there is not. Otherwise, the unprefixed name has no Namespace IRI. NOTE Names conform to the text pattern defined by ISO/IEC 29500-2:2008 and so are less constrained that names in some other schema
45、specifications. name = attribute name text 5.2.4 Extension attributes Extension attributes are attributes in any non-null Namespace other than the Extensible Datatypes namespace. They can occur on any Extensible Datatypes element. The presence of such attributes shall not change the behaviour of the
46、 Extensible Datatypes elements defined in this part of ISO/IEC 19757: an implementation shall return the same result whether extension attributes are processed or not. extension-attribute = attribute * - (local:* | dt:*) text 5.3 Extension elements Extension elements are elements in any Namespace ot
47、her than the Extensible Datatypes Namespace. They may be processed by extended implementations. There are three classes of extension element: top-level extension elements, which occur as children of the document element or div elements definition extension elements, which occur as children of dataty
48、pe elements binding extension elements, which occur wherever a value can be bound (for example, to a variable) BS ISO/IEC 19757-5:2011ISO/IEC 19757-5:2011(E) ISO/IEC 2011 All rights reserved 5extension-element = element * - dt:* must-implement?, attribute * - ( dt:* | must-implement) text *, anythin
49、g 5.4 Versioning and compatibility An Extensible Datatypes element is processed in forwards-compatible mode if it, or its nearest ancestor that has a version attribute, has a version attribute with a value greater than “1.0“. When an element in the Extensible Datatypes namespace that is not described by this part of ISO/IEC 19757 is processed in forwards- compatible mode it, its attributes and its descendants shall be ignored unless it has a mu