<?xml version="1.0" encoding="UTF-8"?>
<!-- ============================================================= -->
<!--                    HEADER                                     -->
<!-- ============================================================= -->
<!--  MODULE:    XML EXCHANGE TABLE MODEL DECLARATION MODULE       -->
<!--  VERSION:   1.1                                             -->
<!--  DATE:      November 2006                                     -->
<!--                                                               -->
<!-- ============================================================= -->
<!-- ============================================================= -->
<!-- SYSTEM:     Darwin Information Typing Architecture (DITA)     -->
<!--                                                               -->
<!-- PURPOSE:    W3C XML Schema to describe DITA Tables            -->
<!--                                                               -->
<!-- ORIGINAL CREATION DATE:                                       -->
<!--             Derived from OASIS Exchange Table Model base      -->
<!--                                                               -->
<!--             (C) Copyright OASIS-Open.org 2005, 2006                -->
<!--             (C) Copyright IBM Corporation 2001, 2004.         -->
<!--             All Rights Reserved.                              -->
<!--                                                               -->
<!--  UPDATES:                                                     -->
<!--    2005.11.15 EAS: Corrected definition for entry element     -->
<!-- ============================================================= -->
<!-- XML EXCHANGE TABLE MODEL DECLARATION MODULE                   -->
<!-- OASIS DITA 1.0 notes:
     The Exchange Table Model replaces the original CALS-based model
     used in development versions of the DITA definition.
     This set of declarations defines the XML version of the Exchange
     Table Model as adapted for OASIS DITA version 1.0.
     The base for the DITA version of the Exchange Table Model is
     defined at http://www.oasis-open.org/specs/tm9901.htm .
     The DITA version specifically extends this model with these DITA-
     specific content and attribute adaptations to the DITA processing
     requirements:

     STRUCTURE:

     Introduce the DITA-unique <desc> element (optional after <title>); this element
     enables more consistent presentation of both figures and tables.


     ATTRIBUTES:

     For the <table> element, add:
     %univ-atts; which consists of:
     %select-atts; [for selection, conditional processing]
     %id-atts; [for conref and linking]
     @translate + @xml:lang) [for NLS processing support]
     %global-atts; (@xtrf + @xtrc) [for tracing and messaging support in processors]
     @class [for specialization support]
     @outputclass [for role designation (ie, styles, future migrations)]
     @rowheader [for accessibility support in processing]
     %display-atts; which consists of:
     @scale [for presentational equivalence with other scaled exhibits: fig, pre, lines, simpletable]
     @frame (already part of table)
     @pgwide (already part of table, same intent as original @expanse)

     For <tgroup>, <thead>, <tbody>, and <row>, add:
     %univ-atts;
     %global-atts;
     @class
     @outputclass [for role designation (ie, styles, future migrations)]

     For <entry>, add:
     %id-atts;
     %global-atts
     @class
     @outputclass [for role designation (ie, styles, future migrations)]
     @rev [for indication of revised content for flag-based processing]

     -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:element name="table">
    <xs:annotation>
      <xs:documentation>
        The &lt;<keyword>table</keyword>> element organizes arbitrarily
        complex relationships of tabular information. This standard table markup allows
        column or row spanning and table captions or descriptions. A optional title
        allowed inside the table element provides a caption to describe the table.
        See <ph><xref href="simpletable.xml">simpletable</xref></ph> for a simplified
        table model that can be specialized to represent more regular relationships
        of data.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="table.class">
          <xs:attribute ref="class" default="- topic/table "/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="table.class">
    <xs:sequence>
      <xs:sequence minOccurs="0">
        <xs:group ref="title" minOccurs="0"/>
        <xs:group ref="desc" minOccurs="0"/>
      </xs:sequence>
      <xs:group ref="tgroup" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="colrowsep-atts"/>
    <xs:attribute name="pgwide" type="xs:string"/>
    <xs:attribute name="scale" type="scale-atts.class"/>
    <xs:attribute name="frame" type="frame-att.class"/>
    <xs:attribute name="rowheader" type="rowheader-att.class"/>
    <xs:attribute name="outputclass" type="xs:string"/>
    <xs:attributeGroup ref="univ-atts"/>
    <xs:attributeGroup ref="global-atts"/>
  </xs:complexType>
  
  <xs:simpleType name="rowheader-att.class">
    <xs:restriction base="xs:string">
      <xs:enumeration value="firstcol"/>
      <xs:enumeration value="norowheader"/>
      <xs:enumeration value="-dita-use-conref-target"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:element name="tgroup">
    <xs:annotation>
      <xs:documentation>
        The &lt;<keyword>tgroup</keyword>> element in a table contains
        column, row, spanning, header and footer specifications, and the body (&lt;<keyword>tbody</keyword>>)
        of the table.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="tgroup.class">
          <xs:attribute ref="class" default="- topic/tgroup "/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="tgroup.class">
    <xs:sequence>
      <xs:group ref="colspec" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="thead" minOccurs="0"/>
      <xs:group ref="tbody"/>
    </xs:sequence>
    <xs:attribute name="cols" type="xs:NMTOKEN" use="required"/>
    <xs:attributeGroup ref="colrowsep-atts"/>
    <xs:attribute name="align" type="align-att.class"/>
    <xs:attribute name="outputclass" type="xs:string"/>
    <xs:attributeGroup ref="univ-atts"/>
    <xs:attributeGroup ref="global-atts"/>
  </xs:complexType>
  
  <xs:attributeGroup name="colrowsep-atts">
    <xs:attribute name="colsep" type="xs:string"/>
    <xs:attribute name="rowsep" type="xs:string"/>
  </xs:attributeGroup>
  
  <xs:element name="colspec">
    <xs:annotation>
      <xs:documentation>
        The &lt;<keyword>colspec</keyword>> element contains a column specification
        for a table, including assigning a column name and number, cell content alignment,
        and column width.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="colspec.class">
          <xs:attribute ref="class" default="- topic/colspec "/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="colspec.class">
    <xs:attribute name="colnum" type="xs:NMTOKEN"/>
    <xs:attribute name="colname" type="xs:NMTOKEN"/>
    <xs:attribute name="align" type="align-att.class"/>
    <xs:attribute name="colwidth" type="xs:string"/>
    <xs:attributeGroup ref="colrowsep-atts"/>
    <xs:attribute name="char" type="xs:string"/>
    <xs:attribute name="charoff" type="xs:NMTOKEN"/>
    <xs:attribute name="base" type="xs:string" />
    <xs:attributeGroup ref="base-attribute-extensions"/>
    <xs:attributeGroup ref="id-atts"/>
    <xs:attributeGroup ref="localization-atts"/>
    <xs:attributeGroup ref="global-atts"/>
  </xs:complexType>
  
  <xs:element name="thead">
    <xs:annotation>
      <xs:documentation>
        The table header (&lt;<keyword>thead</keyword>>) element precedes
        the table body (&lt;<keyword>tbody</keyword>>) element in a complex table.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="thead.class">
          <xs:attribute ref="class" default="- topic/thead "/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="thead.class">
    <xs:sequence>
      <xs:group ref="row" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="valign" type="valign-att.class"/>
    <xs:attribute name="outputclass" type="xs:string"/>
    <xs:attributeGroup ref="univ-atts"/>
    <xs:attributeGroup ref="global-atts"/>
  </xs:complexType>
  
  
  <xs:element name="tbody">
    <xs:annotation>
      <xs:documentation>
        The &lt;<keyword>tbody</keyword>> element contains the rows in
        a table.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="tbody.class">
          <xs:attribute ref="class" default="- topic/tbody "/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="tbody.class">
    <xs:choice>
      <xs:group ref="row" maxOccurs="unbounded"/>
    </xs:choice>
    <xs:attribute name="valign" type="valign-att.class"/>
    <xs:attribute name="outputclass" type="xs:string"/>
    <xs:attributeGroup ref="univ-atts"/>
    <xs:attributeGroup ref="global-atts"/>
  </xs:complexType>
  
  
  <xs:element name="row">
    <xs:annotation>
      <xs:documentation>The &lt;<keyword>row</keyword>> element contains a single row in
        a table &lt;<keyword>tgroup</keyword>>.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="row.class">
          <xs:attribute ref="class" default="- topic/row "/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="row.class">
    <xs:choice>
      <xs:group ref="entry" maxOccurs="unbounded"/>
    </xs:choice>
    <xs:attribute name="rowsep" type="xs:string"/>
    <xs:attribute name="valign" type="valign-att.class"/>
    <xs:attribute name="outputclass" type="xs:string"/>
    <xs:attributeGroup ref="univ-atts"/>
    <xs:attributeGroup ref="global-atts"/>
  </xs:complexType>
  
  
  <xs:element name="entry">
    <xs:annotation>
      <xs:documentation>The &lt;<keyword>entry</keyword>> element defines a single cell
        in a table.        
      </xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="true">
      <xs:complexContent>
        <xs:extension base="entry.class">
          <xs:attribute ref="class" default="- topic/entry "/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="entry.class" mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:group ref="tblcell.cnt"/>
    </xs:choice>
    <xs:attribute name="namest" type="xs:NMTOKEN"/>
    <xs:attribute name="nameend" type="xs:NMTOKEN"/>
    <xs:attribute name="spanname" type="xs:string"/>
    <xs:attribute name="colname" type="xs:NMTOKEN"/>
    <xs:attribute name="morerows" type="xs:NMTOKEN"/>
    <xs:attribute name="char" type="xs:string"/>
    <xs:attribute name="charoff" type="xs:NMTOKEN"/>
    <xs:attributeGroup ref="colrowsep-atts"/>
    <xs:attribute name="align" type="align-att.class"/>
    <xs:attribute name="valign" type="valign-att.class"/>
    <xs:attribute name="rev" type="xs:string"/>
    <xs:attribute name="outputclass" type="xs:string"/>
    <xs:attribute name="base" type="xs:string" />
    <xs:attributeGroup ref="base-attribute-extensions"/>
    <xs:attributeGroup ref="id-atts"/>
    <xs:attributeGroup ref="localization-atts"/>
    <xs:attributeGroup ref="global-atts"/>
    <!-- added DITA attributes -->
  </xs:complexType>
  <xs:simpleType name="align-att.class">
    <xs:restriction base="xs:string">
      <xs:enumeration value="left"/>
      <xs:enumeration value="right"/>
      <xs:enumeration value="center"/>
      <xs:enumeration value="justify"/>
      <xs:enumeration value="-dita-use-conref-target"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="valign-att.class">
    <xs:restriction base="xs:string">
      <xs:enumeration value="top"/>
      <xs:enumeration value="middle"/>
      <xs:enumeration value="bottom"/>
      <xs:enumeration value="-dita-use-conref-target"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>
