# xstructural 3.0.0-beta0002

| Property | Value |
| --- | --- |
| CREATOR | Mark Raynsford |
| DATE | 2021-06-27T00:00:00Z |
| DESCRIPTION | User documentation for the com.io7m.xstructural package. |
| IDENTIFIER | 59c00e65-2e1e-4e86-97b5-b4b1a650eea5 |
| LANGUAGE | en |
| RIGHTS | Public Domain |
| TITLE | xstructural 3.0.0-beta0002 |


## Table Of Contents

- [1. Language](#d0e37)
  - [1.1. Description](#d0e39)
  - [1.2. Document](#id_a49dac27-48f0-4504-8e03-8f0b73cd9c46)
  - [1.3. Metadata](#id_027296c3-c406-4191-a444-5b10873094e8)
  - [1.4. Section](#id_cc5514e1-dc68-4b88-9374-fe09b8741140)
  - [1.5. Subsection](#id_55ae1912-9aec-402a-babe-ed7778e76599)
  - [1.6. Paragraph](#id_01d0fde7-7742-47a9-864c-b9c55e2e9980)
  - [1.7. FormalItem](#id_13029feb-2126-4d72-9151-63607152b7db)
  - [1.8. Footnote](#id_8abc7eeb-c828-4307-a64d-0d8d6ae25e98)
  - [1.9. Inline Elements](#id_8e536f96-16e1-4f4a-bc3a-6613e20cb504)
- [2. Types](#id_26f17f0a-f486-4722-ad6d-8504c3bb1ad6)
  - [2.1. Overview](#d0e1083)
  - [2.2. Schema](#d0e1103)
- [3. Command-Line Interface](#id_41890668-2d97-42e1-aa10-7efc4f36297f)
  - [3.1. Overview](#d0e1120)
  - [3.2. EPUB](#d0e1137)
  - [3.3. Format](#d0e1264)
  - [3.4. Markdown](#d0e1341)
  - [3.5. Schema](#d0e1459)
  - [3.6. Validate](#d0e1535)
  - [3.7. Validate-XHTML](#d0e1606)
  - [3.8. XHTML](#d0e1676)
- [4. Maven Plugin](#d0e1831)
  - [4.1. Overview](#d0e1833)
  - [4.2. Usage](#d0e1842)
  - [4.3. Skipping](#d0e1856)
  - [4.4. Format](#d0e1868)
- [5. API](#d0e1893)
  - [5.1. Usage](#d0e1895)
  - [5.2. JavaDoc](#d0e1903)
- [6. Schema](#id_3c28e89e-a225-46ba-bbc5-5c989425a509)
- [7. License](#id_b3169e89-019a-41b8-89e5-49b985fd25df)


<a id="d0e37"/>

## 1. Language

<a id="d0e39"/>

## 1.1. Description

<a id="d0e41"/>

### 1.1.1. Overview

The **xstructural** package provides an [XSLT 2.0](https://www.w3.org/TR/xslt20/) implementation of the **structural** documentation language.

In contrast to other systems such as [DocBook](http://www.docbook.org/), the **structural** language only defines elements concerning the structure of the document and not the semantics of the elements. The intention is that higher level languages will produce **structural** documents as output and then use the provided stylesheets to get various services such as table of contents generation, chapter numbering, footnotes, et cetera, without having to re-implement all of those features for each new language.

<a id="d0e68"/>

### 1.1.2. Schema

The following sections provide informative descriptions of the available language elements. The actual language is defined as an [XSD](https://www.w3.org/TR/xmlschema-1/) schema, and this is provided in the [Schema](#id_3c28e89e-a225-46ba-bbc5-5c989425a509) section.

<a id="d0e80"/>

### 1.1.3. Versioning

The **structural** language is designed in a manner that is intended to conform to [Semantic Versioning 2.0.0](https://semver.org/). More specifically:

<a id="d0e91"/>

#### 1.1.3.2. Versioning Rules

- If a document **D** was written using schema version **(x, y)**, where **x** is the schema **major version** and **y** is the schema **minor version**, then if the schema version declaration in **D** is changed to **(x, z)** for any existing schema minor version **z**, then **D** is guaranteed to validate against the new schema version.
- If a document **D** was written using schema version **(x, y)**, where **x** is the schema **major version** and **y** is the schema **minor version**, then if the schema version declaration in **D** is changed to **(a, b)** for any existing schema major version **a** and minor version **b** such that **a ≠ x**, then **D** is NOT guaranteed to validate against the new schema version.


Informally: Minor version changes indicate compatible changes; if you update your document to use the latest minor version of the same major version schema, then you will not have to modify your document to get it to validate. Major version changes indicate incompatible changes; if you update your document to use the latest major version schema, then you may have to make changes to your document in order to get it to validate.

<a id="id_a49dac27-48f0-4504-8e03-8f0b73cd9c46"/>

## 1.2. Document

<a id="d0e178"/>

### 1.2.1. Description

The **Document** element describes the top-level structure of a document. A document consists of [metadata](#id_027296c3-c406-4191-a444-5b10873094e8), and a set of top-level [sections](#id_cc5514e1-dc68-4b88-9374-fe09b8741140) or [subsections](#id_55ae1912-9aec-402a-babe-ed7778e76599) (but not both).

A **Document** must carry a **schema version declaration** that indicates to which version of the **structural** language the document is expected to conform. This is achieved with the use of an [xmlns](https://www.w3.org/TR/REC-xml-names/) attribute on the **Document** element. The currently published language versions are:

<a id="d0e213"/>

#### 1.2.1.3. Language Versions

| Language | Identifier |
| --- | --- |
| Structural 7.0 | urn:com.io7m.structural:7:0 |
 | Structural 8.0 | urn:com.io7m.structural:8:0 |
 | Structural 9.0 | urn:com.io7m.structural:9:0 |


<a id="d0e248"/>

### 1.2.2. Tables Of Content

Renderers encountering a **Document** element will typically generate a table of contents for the entire document. The **tableOfContentsDepth** attribute on the **Document** instructs renderers as to how far into the list of [sections](#id_cc5514e1-dc68-4b88-9374-fe09b8741140) or [subsections](#id_55ae1912-9aec-402a-babe-ed7778e76599) the rendering algorithm should recurse in order to generate the table of contents. For example, an author may choose to only include top-level **Section** elements in the table of contents and would therefore specify **tableOfContentsDepth="1"**.

<a id="id_39506c3e-1361-4f81-be32-8c110a19d9bb"/>

### 1.2.3. Identities

Many elements within a **Document** may be assigned **unique identifiers**. A **unique identifier** is a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) value specified using the **id** attribute. It is possible to then link to those elements from within the document text using the [Link](#id_88660fca-74ea-4a3b-bb59-32d750a515a3) element, and the schema will guarantee the integrity of internal links at validation time.

<a id="d0e301"/>

### 1.2.4. Links

As described in the [Identities](#id_39506c3e-1361-4f81-be32-8c110a19d9bb) section, many significant elements in a document may be the target of the [Link](#id_88660fca-74ea-4a3b-bb59-32d750a515a3) element. The **structural** language distinguishes between different types of links in order to apply varying degrees of integrity checking, and to allow renderers to render links differently based on types. The following kinds of links are currently supported:

<a id="d0e315"/>

#### 1.2.4.2. Link Types

- [Link](#id_88660fca-74ea-4a3b-bb59-32d750a515a3) - a link to a document element. Subject to integrity checks at validation time.
- [LinkExternal](#id_217b1f13-a98b-4fe7-a701-700073818f33) - a link to an external document such as a web site. Not subject to integrity checks.
- [LinkFootnote](#id_b611d66f-e82d-4afd-b908-f27340718651) - a link to a footnote. Subject to integrity checks at validation time.


<a id="id_09b89d86-aed4-4d4b-805d-d8aec81206e1"/>

### 1.2.5. Types

Most elements within documents allow for the specification of **type** attributes. The **type** attribute is used to add semantic tags to elements that can be interpreted by renderers in various ways. Typically, the **type** attribute is translated directly to a [CSS](https://en.wikipedia.org/wiki/CSS) class. The attributes can also be consumed by document processors that are trying to extract other semantic information from documents. For example, in this documentation, the term **xstructural** is always expressed as a [Term](#id_8265ab1b-7524-4af9-8415-3dc787bd959f) element with a **type** attribute set to **package**. This is intended to indicate to a document processor that the term means "a software package named xstructural". Document authors that are not interested in semantic information can use the **type** attribute purely for formatting, or alternatively can ignore it entirely.

<a id="d0e375"/>

### 1.2.6. Examples

<a id="d0e377"/>

#### 1.2.6.1. Document Example

```
<Document xmlns="urn:com.io7m.structural:9:0" tableOfContentsDepth="2" id="14ab90da-7947-420c-a5f8-d9c9c87fbddc">
  ...
</Document>
```


<a id="id_027296c3-c406-4191-a444-5b10873094e8"/>

## 1.3. Metadata

<a id="d0e386"/>

### 1.3.1. Description

The **Metadata** element describes the metadata of a document. The element consists of a sequence of zero or more [Dublin Core](http://dublincore.org/) elements [1](#id_7c66cd52-4ace-4fd6-a05d-fd0255e441bb), followed by a sequence of zero or more **MetaProperty** elements [2](#id_9977adf0-b726-46e6-bc98-11176e1d2916). Metadata is not considered to contribute to the semantics of a document. That is, a document with all of the metadata removed is still considered to be semantically valid if the original document was valid. Metadata is typically used to influence the behaviour of any renderers that are processing the document, and are also used to communicate information to external systems that may be, for example, indexing the document for use in a document retrieval system. Metadata can appear in tables in rendered documents, although this can be controlled using the boolean **visible** attribute (which defaults to **false**).

Some **MetaProperty** names are significant to renderers and, where those renderers are known (such as by being part of the **xstructural** package), the significance of names is documented in the following subsections.

Document authors are strongly recommended to **namespace** their **MetaProperty** names using [reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) , ideally using a domain that they control. **MetaProperty** names must contain at least two segments consisting of characters taken from the set **[a (U+0061), z (U+007A)] ∪ [0 (U+0030), 9 (U+0039)] ∪ { _ (U+005F) } ∪ { _ (U+002D) }** , separated by **. (U+002E)**.

<a id="d0e443"/>

### 1.3.2. EPUB

<a id="d0e445"/>

### 1.3.2.1. Package

This section documents the property names used by the EPUB renderer included with **xstructural 1.3.0** and newer.

<a id="d0e454"/>

### 1.3.2.2. com.io7m.xstructural.epub.cover

The contents of this property denote the relative (to the input document) filename of the cover image that will be used for the book. The renderer will translate this name into the correct resource name within the EPUB during rendering.

<a id="d0e459"/>

### 1.3.2.3. com.io7m.xstructural.epub.colophon

The contents of this property denote the relative (to the input document) filename of an XHTML file that will be inserted into the **colophon** page of the generated EPUB.

<a id="d0e468"/>

### 1.3.2.4. com.io7m.xstructural.epub.resource

The contents of this property add an extra file to the manifest. The property can be specified multiple times to add multiple resources. The resources are resolved relative to the source directory of the document.

<a id="d0e473"/>

### 1.3.2.5. com.io7m.xstructural.epub.resource-list

The contents of this property denote a file that contains a list of extra resources to add to the manifest. The file name is resolved relative to the source directory of the document. The file must contain one resource file per line. For example, if a file named **extra-files.txt** contains the following text:

<a id="d0e481"/>

#### 1.3.2.5.2. Example File List

```
file0.txt
file1.txt
file2.txt
```


Then the following **MetaProperty** declarations are effectively equivalent:

<a id="d0e492"/>

#### 1.3.2.5.4. Example File List

```
<MetaProperty name="com.io7m.xstructural.epub.resource-list">extra-files.txt</MetaProperty>
```


<a id="d0e497"/>

#### 1.3.2.5.5. Example Files

```
<MetaProperty name="com.io7m.xstructural.epub.resource">file0.txt</MetaProperty>
<MetaProperty name="com.io7m.xstructural.epub.resource">file1.txt</MetaProperty>
<MetaProperty name="com.io7m.xstructural.epub.resource">file2.txt</MetaProperty>
```


<a id="d0e504"/>

### 1.3.2.6. Examples

<a id="d0e506"/>

#### 1.3.2.6.1. EPUB Example

```
<Document xmlns="urn:com.io7m.structural:9:0"
          xmlns:dc="http://purl.org/dc/elements/1.1/">
  <Metadata>
    <dc:title>Example Document</dc:title>
    <MetaProperty name="com.io7m.xstructural.epub.colophon">colophon_extra.xml</MetaProperty>
    <MetaProperty name="com.io7m.xstructural.epub.cover">cover.jpg</MetaProperty>
    <MetaProperty name="com.io7m.xstructural.epub.resource">file0.txt</MetaProperty>
    <MetaProperty name="com.io7m.xstructural.epub.resource">file1.txt</MetaProperty>
    <MetaProperty name="com.io7m.xstructural.epub.resource">file2.txt</MetaProperty>
    <MetaProperty name="com.io7m.xstructural.epub.resource-list">extra-files.txt</MetaProperty>
  </Metadata>
...
```


<a id="d0e513"/>

### 1.3.3. Web

<a id="d0e515"/>

### 1.3.3.1. Package

This section documents the property names used by the web renderer included with **xstructural 1.3.0** and newer.

<a id="d0e524"/>

### 1.3.3.2. com.io7m.xstructural.web.branding.header

The contents of this property denote the relative (to the input document) filename of an XHTML file **f** that will be inserted verbatim as the first element of the XHTML **body** element.

<a id="d0e536"/>

### 1.3.3.3. com.io7m.xstructural.web.branding.footer

The contents of this property denote the relative (to the input document) filename of an XHTML file **f** that will be inserted verbatim as the last element of the XHTML **body** element.

<a id="d0e548"/>

### 1.3.3.4. com.io7m.xstructural.web.cover

The contents of this property denote the relative (to the input document) filename of the cover image that will be used for the book.

<a id="d0e554"/>

### 1.3.4. Markdown

<a id="d0e556"/>

### 1.3.4.1. Package

This section documents the property names used by the Markdown renderer.

<a id="d0e561"/>

### 1.3.4.2. com.io7m.xstructural.markdown.header

The contents of this property denote the relative (to the input document) filename of a Markdown file **f** that will be inserted verbatim at the very beginning of the generated Markdown output, before the document title.

<a id="d0e570"/>

### 1.3.4.3. com.io7m.xstructural.markdown.footer

The contents of this property denote the relative (to the input document) filename of a Markdown file **f** that will be inserted verbatim at the very end of the generated Markdown output, after the document footnotes.

<a id="id_cc5514e1-dc68-4b88-9374-fe09b8741140"/>

## 1.4. Section

<a id="d0e605"/>

### 1.4.1. Description

The **Section** element describes the most structurally significant division of a document. A **Section** is analogous to a [chapter](https://en.wikipedia.org/wiki/Chapter_(books)) in printed books and it is expected that the majority of documents will consist of a set of top-level **Section** elements.

Renderers that output multiple files and/or pages are required to treat **Section** elements as page-breaking. That is, when a renderer encounters a new **Section** element, it completes rendering of the existing content and then begins an entirely new page and/or output file. This is in contrast to [Subsection](#id_55ae1912-9aec-402a-babe-ed7778e76599) elements which are required NOT to trigger the generation of new files and/or pages.

**Section** elements are automatically numbered by the renderers, and may be assigned [unique identifiers](#id_39506c3e-1361-4f81-be32-8c110a19d9bb). **Section** elements may be nested recursively, and are numbered recursively with respect to other **Section** elements.

**Section** elements must include titles, and renderers use these titles when populating [tables of content](#id_8430e3b6-3327-4390-a19f-e315d7dcf3d8).

<a id="id_8430e3b6-3327-4390-a19f-e315d7dcf3d8"/>

### 1.4.2. Tables Of Content

Renderers may optionally produce **tables of content** within rendered sections. The default behaviour is to always produce tables of content, but this may be influenced using the **tableOfContents** and **tableOfContentsDepth** attributes. If the **tableOfContents** attribute is set to **false**, then no table is generated. If the **tableOfContents** attribute is set to **true**, then a table will be generated containing **Section** and [Subsection](#id_55ae1912-9aec-402a-babe-ed7778e76599) elements up to a maximum depth of **tableOfContentsDepth**.

<a id="d0e696"/>

### 1.4.3. Examples

<a id="d0e698"/>

#### 1.4.3.1. Section Example

```
<Section xmlns="urn:com.io7m.structural:9:0"
         id="4e035356-53d9-4d09-ab6b-ec2c683218f5"
         title="Section">
  <Section title="Another Section">
    ...
  </Section>
  <Section title="Yet Another Section" id="6c311772-c7c8-4c28-979f-a5815795643b">
    ...
  </Section>
</Section>
```


<a id="id_55ae1912-9aec-402a-babe-ed7778e76599"/>

## 1.5. Subsection

<a id="d0e707"/>

### 1.5.1. Description

The **Subsection** element describes a subdivision of a [Section](#id_cc5514e1-dc68-4b88-9374-fe09b8741140).

Renderers that output multiple files and/or pages are required to treat **Subsection** elements as non-page-breaking. That is, when a renderer encounters a new **Subsection** element, it completes rendering of the existing content and then begins rendering of the **Subsection** on the current page and/or output file. This is in contrast to [Section](#id_cc5514e1-dc68-4b88-9374-fe09b8741140) elements which are required to trigger the generation of new files and/or pages.

**Subsection** elements are automatically numbered by the renderers, and may be assigned [unique identifiers](#id_39506c3e-1361-4f81-be32-8c110a19d9bb). **Subsection** elements may be nested recursively, and are numbered recursively with respect to other [Section](#id_cc5514e1-dc68-4b88-9374-fe09b8741140) and **Subsection** elements.

**Subsection** elements must include titles, and renderers use these titles when populating [tables of content](#id_8430e3b6-3327-4390-a19f-e315d7dcf3d8).

<a id="d0e761"/>

### 1.5.2. Examples

<a id="d0e763"/>

#### 1.5.2.1. Subsection Example

```
<Subsection xmlns="urn:com.io7m.structural:9:0"
         id="1f56418e-f724-47ad-be10-db92b3e55295"
         title="Subsection">
  <Subsection title="Another Subsection">
    ...
  </Subsection>
  <Subsection title="Yet Another Subsection" id="49698ed6-466b-4917-90be-45480d78719c">
    ...
  </Subsection>
</Subsection>
```


<a id="id_01d0fde7-7742-47a9-864c-b9c55e2e9980"/>

## 1.6. Paragraph

<a id="d0e773"/>

### 1.6.1. Description

The **Paragraph** element describes a subdivision of a [Section](#id_cc5514e1-dc68-4b88-9374-fe09b8741140) or [Subsection](#id_55ae1912-9aec-402a-babe-ed7778e76599).

**Paragraph** elements consist entirely of [inline content](#id_8e536f96-16e1-4f4a-bc3a-6613e20cb504).

**Paragraph** elements are numbered with respect to other **Paragraph** and [FormalItem](#id_13029feb-2126-4d72-9151-63607152b7db) elements within the same [Section](#id_cc5514e1-dc68-4b88-9374-fe09b8741140) or [Subsection](#id_55ae1912-9aec-402a-babe-ed7778e76599).

<a id="d0e815"/>

### 1.6.2. Examples

<a id="d0e817"/>

#### 1.6.2.1. Paragraph Example

```
<Subsection xmlns="urn:com.io7m.structural:9:0"
         id="0636fa84-2bd5-4cb5-acc5-10ca70948bbf"
         title="Subsection">
  <Paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam id
consectetur nunc. Donec nisi augue, pulvinar eu condimentum at,
pellentesque a libero. Fusce sed tortor quam. Donec et ipsum diam.
Sed eget molestie lacus, non rutrum risus. Orci varius natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra,
per inceptos himenaeos. Nullam pellentesque est eu augue faucibus
molestie. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vivamus sed tincidunt justo.
Sed venenatis enim ac quam euismod, eget semper augue congue.
Integer interdum porttitor porta. Vestibulum eget neque vitae est
congue fringilla. Fusce ac dui suscipit, porttitor velit eu,
rutrum massa. Quisque quis fringilla felis.
  </Paragraph>
  <Paragraph>
Nunc et volutpat arcu. Donec mi nisi, sodales eget egestas sed,
suscipit eget arcu. Cras nibh ligula, maximus eu urna sit amet,
efficitur tempus elit. Sed nec massa auctor, blandit risus in,
dapibus purus. In et neque dignissim, pharetra elit ac, auctor
diam. Ut nisl odio, imperdiet sit amet purus quis, laoreet cursus
dui. Fusce dui neque, aliquet eu augue nec, pharetra laoreet odio.
Sed in scelerisque erat, sit amet sagittis turpis. In suscipit
mauris mauris, ut elementum nulla lacinia quis. Duis tristique
placerat porttitor. Cras vitae convallis purus. Aenean sed
suscipit leo, non dapibus lectus. Proin ac luctus lectus.
  </Paragraph>
</Subsection>
```


<a id="id_13029feb-2126-4d72-9151-63607152b7db"/>

## 1.7. FormalItem

<a id="d0e826"/>

### 1.7.1. Description

The **FormalItem** element is analogous to a [Paragraph](#id_01d0fde7-7742-47a9-864c-b9c55e2e9980) except that it has a defined title. A **FormalItem** element is commonly used to represent an object similar to a **figure** in printed books.

**FormalItem** elements consist entirely of [inline content](#id_8e536f96-16e1-4f4a-bc3a-6613e20cb504).

**FormalItem** elements are numbered with respect to other **FormalItem** and [Paragraph](#id_01d0fde7-7742-47a9-864c-b9c55e2e9980) elements within the same [Section](#id_cc5514e1-dc68-4b88-9374-fe09b8741140) or [Subsection](#id_55ae1912-9aec-402a-babe-ed7778e76599).

<a id="d0e871"/>

### 1.7.2. Examples

This example is, itself, a **FormalItem** element.

<a id="d0e879"/>

#### 1.7.2.2. FormalItem Example

```
<Subsection xmlns="urn:com.io7m.structural:9:0"
         id="0636fa84-2bd5-4cb5-acc5-10ca70948bbf"
         title="Subsection">
  <FormalItem title="FormalItem Example">
    <Image source="http://www.example.com/image.png">
      An example image.
    </Image>
  </FormalItem>
</Subsection>
```


<a id="d0e884"/>

#### 1.7.2.3. FormalItem Table

```
<Table type="genericTable">
  <Columns>
    <Column>Language</Column>
    <Column>Identifier</Column>
  </Columns>
  <Row>
    <Cell>Structural 7.0</Cell>
    <Cell>urn:com.io7m.structural:7:0</Cell>
  </Row>
  <Row>
    <Cell>Structural 8.0</Cell>
    <Cell>urn:com.io7m.structural:8:0</Cell>
  </Row>
  <Row id="9ad372d8-1d06-47b5-8d86-93b536c50053">
    <Cell>Structural 9.0</Cell>
    <Cell>urn:com.io7m.structural:9:0</Cell>
  </Row>
</Table>
```


<a id="d0e889"/>

#### 1.7.2.4. FormalItem Table (Rendered)

<a id="d0e891"/>

| Language | Identifier |
| --- | --- |
| Structural 7.0 | urn:com.io7m.structural:7:0 |
 | Structural 8.0 | urn:com.io7m.structural:8:0 |
 | Structural 9.0 | urn:com.io7m.structural:9:0 |


Note that it is possible to [link to table rows](#d0e891).

<a id="id_8abc7eeb-c828-4307-a64d-0d8d6ae25e98"/>

## 1.8. Footnote

<a id="d0e933"/>

### 1.8.1. Description

The **Footnote** element describes a [footnote](https://en.wikipedia.org/wiki/Note_(typography)).

Footnotes a rendered at the end of the [Section](#id_cc5514e1-dc68-4b88-9374-fe09b8741140) within which they are declared, and may be referenced using [LinkFootnote](#id_b611d66f-e82d-4afd-b908-f27340718651) elements.

<a id="d0e954"/>

### 1.8.2. Examples

<a id="d0e956"/>

#### 1.8.2.1. Footnote Example

```
<Footnote id="7c66cd52-4ace-4fd6-a05d-fd0255e441bb">
  The Dublin Core elements are optional, but some renderers may require them in order to produce sensible output. The
  title of a <Link target="a49dac27-48f0-4504-8e03-8f0b73cd9c46">Document</Link> is specified using the
  <LinkExternal target="https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#http://purl.org/dc/terms/title">dc:title</LinkExternal>
  element, for example.
</Footnote>
```


<a id="id_8e536f96-16e1-4f4a-bc3a-6613e20cb504"/>

## 1.9. Inline Elements

<a id="id_88660fca-74ea-4a3b-bb59-32d750a515a3"/>

### 1.9.1. Link

The **Link** element describes a link to an element that was assigned a [unique identifier](#id_39506c3e-1361-4f81-be32-8c110a19d9bb). The text contents of the **Link** element are used as the [anchor text](https://en.wikipedia.org/wiki/HTML_element#Anchor) when generating hyperlinks in rendered documents.

The **Link** element is subject to integrity checking; documents that declare links to nonexistent elements will fail validation and renderers will refuse to process them.

<a id="id_217b1f13-a98b-4fe7-a701-700073818f33"/>

### 1.9.2. LinkExternal

The **LinkExternal** element describes a link to an external resource such as a web site. The text contents of the **LinkExternal** element are used as the [anchor text](https://en.wikipedia.org/wiki/HTML_element#Anchor) when generating hyperlinks in rendered documents.

<a id="id_b611d66f-e82d-4afd-b908-f27340718651"/>

### 1.9.3. LinkFootnote

The **LinkFootnote** element describes a link to a [Footnote](#id_8abc7eeb-c828-4307-a64d-0d8d6ae25e98) element.

Footnote links are expected to be rendered in the traditional style. That is, a link to a footnote is rendered as the number of the footnote enclosed in square brackets.

<a id="id_90ba0e6b-5bf9-4ece-beba-de6c01083ee9"/>

### 1.9.4. ListOrdered

The **ListOrdered** element describes a list within which the order of the [items](#id_c8d7692d-1871-4332-92df-bcb8196e9fa8) is significant.

<a id="id_7eed6ef8-aeba-45cd-8f72-0b016593aed2"/>

### 1.9.5. ListUnordered

The **ListUnordered** element describes a list within which the order of the [items](#id_c8d7692d-1871-4332-92df-bcb8196e9fa8) is not significant.

<a id="id_c8d7692d-1871-4332-92df-bcb8196e9fa8"/>

### 1.9.6. Item

The **Item** element describes an item within a [ListUnordered](#id_7eed6ef8-aeba-45cd-8f72-0b016593aed2) or [ListOrdered](#id_90ba0e6b-5bf9-4ece-beba-de6c01083ee9) element.

<a id="id_85c2d15e-38e9-48bc-a24a-77dcac9c0eaa"/>

### 1.9.7. Table

The **Table** element defines a table as a set of rows and columns. It is analogous to a simplified form of the XHTML **table** element.

<a id="id_8265ab1b-7524-4af9-8415-3dc787bd959f"/>

### 1.9.8. Term

The **Term** element denotes a single word or sentence as being significant.

<a id="id_26f17f0a-f486-4722-ad6d-8504c3bb1ad6"/>

## 2. Types

<a id="d0e1083"/>

### 2.1. Overview

The **xstructural** package provides a simple checker for [type](#id_09b89d86-aed4-4d4b-805d-d8aec81206e1) attributes. Given a file of **type declarations**, the checker will ensure that all type attributes that appear in a document refer to declared types. If a type attribute refers to a nonexistent type, the document will fail to validate.

<a id="d0e1097"/>

#### 2.1.2. Example

```
<Types xmlns="urn:com.io7m.structural.types:1:0">
  <Type Name="package">
    <Description xml:lang="en">
      A name of a software package.
    </Description>
    <Description xml:lang="fr">
      Le nom d'un logiciel de service.
    </Description>
    <Description xml:lang="de">
      Ein Name eines Softwarepakets.
    </Description>
  </Type>
</Types>
```


<a id="d0e1103"/>

### 2.2. Schema

A **type declaration file** must conform to the following schema:

<a id="d0e1111"/>

#### 2.2.2. Type Declaration Schema

```
<?xml version="1.0" encoding="UTF-8" ?>

<!--
  Copyright © 2025 Mark Raynsford <code@io7m.com> https://www.io7m.com

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted, provided that the above
  copyright notice and this permission notice appear in all copies.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
  IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            xmlns:t="urn:com.io7m.structural.types:1:0"
            targetNamespace="urn:com.io7m.structural.types:1:0">

  <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
              schemaLocation="xml.xsd"/>

  <xsd:simpleType name="VersionNameType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of package (semantic) versions.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="([0-9]{1,8})\.([0-9]{1,8})\.([0-9]{1,8})"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="PackageNameType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of package names.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="([a-z][a-z0-9_-]{0,63})(\.[a-z][a-z0-9_-]{0,62}){0,15}"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="TypeNameType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of type names. Type names are used to categorize elements and
        are somewhat analogous to CSS classes, except that they are intended to
        be used for more than just styling documents.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z][a-zA-Z0-9_\.\-]*"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="DescriptionType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A human-readable description of the meaning of a type.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:attribute ref="xml:lang"
                   use="required"/>
  </xsd:complexType>

  <xsd:element name="Description"
               type="t:DescriptionType"/>

  <xsd:element name="Type">
    <xsd:complexType>
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of types.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="t:Description"/>
        </xsd:sequence>
      </xsd:sequence>

      <xsd:attribute ref="xml:base"/>
      <xsd:attribute type="t:TypeNameType"
                     name="Name"
                     use="required"/>
    </xsd:complexType>

    <xsd:unique name="LanguageUnique">
      <xsd:selector xpath="t:Description"/>
      <xsd:field xpath="@xml:lang"/>
    </xsd:unique>
  </xsd:element>

  <xsd:element name="Types">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:sequence minOccurs="0"
                      maxOccurs="unbounded">
          <xsd:choice>
            <xsd:element ref="t:Types"/>
            <xsd:element ref="t:Type"/>
          </xsd:choice>
        </xsd:sequence>
      </xsd:sequence>

      <xsd:attribute ref="xml:base"/>
    </xsd:complexType>

    <xsd:key name="TypeNameUnique">
      <xsd:selector xpath=".//t:Type"/>
      <xsd:field xpath="@Name"/>
    </xsd:key>
  </xsd:element>

</xsd:schema>
```


<a id="id_41890668-2d97-42e1-aa10-7efc4f36297f"/>

## 3. Command-Line Interface

<a id="d0e1120"/>

## 3.1. Overview

The **xstructural** package provides a command-line interface for performing tasks such as validating input documents, and transforming documents to various output formats. The base **xstructural** command is broken into a number of subcommands which are documented over the following sections.

<a id="d0e1131"/>

#### 3.1.2. Command-Line Overview

```
xstructural: usage: xstructural [command] [arguments ...]

  The xstructural structural document format command-line application.
  
  Use the "help" command to examine specific commands:
  
    $ xstructural help help.
  
  Command-line arguments can be placed one per line into a file, and
  the file can be referenced using the @ symbol:
  
    $ echo help > file.txt
    $ echo help >> file.txt
    $ xstructural @file.txt

  Commands:
    epub              Transform a structural document to an EPUB file
    format            Format one or more structural files in place
    help              Show usage information for a command.
    markdown          Transform a structural document to Markdown
    schema            Export the structural schemas to files
    validate          Validate a structural document
    validate-xhtml    Validate an XHTML file
    version           Show the application version.
    xhtml             Transform a structural document to XHTML

  Documentation:
    https://www.io7m.com/software/xstructural/
```


<a id="d0e1137"/>

## 3.2. EPUB

<a id="d0e1139"/>

### 3.2.1. Name

**epub** - Produce an EPUB file

<a id="d0e1147"/>

### 3.2.2. Description

The **epub** command produces a self-contained EPUB file for the given input document. The produced EPUB file is unconditionally checked with [EPUBCheck](https://github.com/w3c/epubcheck).

<a id="d0e1158"/>

#### 3.2.2.2. Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| **--messagesFile** | Path | false | A file that will contain XSLT debugging messages. |
 | **--traceFile** | Path | false | A file that will contain XSLT trace messages. |
 | **--sourceFile** | Path | true | The path to the input document. |
 | **--typeFile** | Path | false | The path to the type description file. |
 | **--outputDirectory** | Path | true | The directory to which output files will be written. |
 | **--outputFileName** | String | false | The name of the output file. |


<a id="d0e1255"/>

### 3.2.3. Examples

<a id="d0e1257"/>

#### 3.2.3.1. Example

```
$ xstructural epub \
  --sourceFile com.io7m.xstructural.documentation/target/documentation/main.xml \
  --outputDirectory out \
  --outputFileName example.epub
xstructural: XSValidator: INFO: validate (xstructural) /home/user/xstructural/com.io7m.xstructural.documentation/target/documentation/main.xml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e168.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e311.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e33.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/colophon.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/cover.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e109.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e331.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e14.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e16.xhtml
xstructural: XSEPUBCreator: INFO: copy out/d2e168.xhtml out/epub/OEBPS/d2e168.xhtml
xstructural: XSEPUBCreator: INFO: copy out/d2e311.xhtml out/epub/OEBPS/d2e311.xhtml
xstructural: XSEPUBCreator: INFO: copy out/d2e33.xhtml out/epub/OEBPS/d2e33.xhtml
xstructural: XSEPUBCreator: INFO: copy out/colophon.xhtml out/epub/OEBPS/colophon.xhtml
xstructural: XSEPUBCreator: INFO: copy out/cover.xhtml out/epub/OEBPS/cover.xhtml
xstructural: XSEPUBCreator: INFO: copy out/d2e109.xhtml out/epub/OEBPS/d2e109.xhtml
xstructural: XSEPUBCreator: INFO: copy out/d2e331.xhtml out/epub/OEBPS/d2e331.xhtml
xstructural: XSEPUBCreator: INFO: copy out/toc.xhtml out/epub/OEBPS/toc.xhtml
xstructural: XSEPUBCreator: INFO: copy out/d2e14.xhtml out/epub/OEBPS/d2e14.xhtml
xstructural: XSEPUBCreator: INFO: copy out/d2e16.xhtml out/epub/OEBPS/d2e16.xhtml
xstructural: XSEPUBCreator: INFO: zip entry mimetype
xstructural: XSEPUBCreator: INFO: zip entry content.opf
xstructural: XSEPUBCreator: INFO: zip entry META-INF/container.xml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/d2e168.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/d2e311.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/d2e33.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/colophon.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/cover.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/d2e109.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/d2e331.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/toc.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/d2e14.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/d2e16.xhtml
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/reset.css
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/structural-epub.css
xstructural: XSEPUBCreator: INFO: zip entry OEBPS/document.css
xstructural: XSEPUBCreator: INFO: validating out/example.epub
xstructural: XSEPUBCreator: INFO: epubcheck: stdout: Validating using EPUB version 3.2 rules.
xstructural: XSEPUBCreator: INFO: epubcheck: stdout: No errors or warnings detected.
xstructural: XSEPUBCreator: INFO: epubcheck: stdout: Messages: 0 fatals / 0 errors / 0 warnings / 0 infos
xstructural: XSEPUBCreator: INFO: epubcheck: stdout:
xstructural: XSEPUBCreator: INFO: epubcheck: stdout: EPUBCheck completed

$ ls -alF out/
total 128
drwxr-xr-x  3 xs xs  4096 Jun 26 12:59 ./
drwxr-xr-x 15 xs xs  4096 Jun 26 12:59 ../
-rw-r--r--  1 xs xs   713 Jun 26 12:59 colophon.xhtml
-rw-r--r--  1 xs xs   566 Jun 26 12:59 cover.xhtml
-rw-r--r--  1 xs xs  6256 Jun 26 12:59 d2e109.xhtml
-rw-r--r--  1 xs xs  3572 Jun 26 12:59 d2e14.xhtml
-rw-r--r--  1 xs xs  4077 Jun 26 12:59 d2e16.xhtml
-rw-r--r--  1 xs xs 10530 Jun 26 12:59 d2e168.xhtml
-rw-r--r--  1 xs xs  3767 Jun 26 12:59 d2e311.xhtml
-rw-r--r--  1 xs xs  7158 Jun 26 12:59 d2e33.xhtml
-rw-r--r--  1 xs xs 36763 Jun 26 12:59 d2e331.xhtml
drwxr-xr-x  4 xs xs  4096 Jun 26 12:59 epub/
-rw-r--r--  1 xs xs     0 Jun 26 12:59 epub-resources.txt
-rw-r--r--  1 xs xs 19337 Jun 26 12:59 example.epub
-rw-r--r--  1 xs xs    99 Jun 26 12:59 messages.log
-rw-r--r--  1 xs xs  2460 Jun 26 12:59 toc.xhtml
-rw-r--r--  1 xs xs  2501 Jun 26 12:59 trace.xml
```


<a id="d0e1264"/>

## 3.3. Format

<a id="d0e1266"/>

### 3.3.1. Name

**format** - Format one or more structural files in place

<a id="d0e1274"/>

### 3.3.2. Description

The **format** command reformats one or more structural files in place. The logical content of each file is unchanged; only the whitespace layout is altered.

One or more files must be provided, either as positional parameters or through the **--sourceFile** parameter, or a combination of both.

<a id="d0e1288"/>

#### 3.3.2.3. Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| **file** | Path | true | One or more source files to be formatted in place, given as positional parameters. |
 | **--sourceFile** | Path | false | One or more source files to be formatted in place, given as an alternative to the positional parameters. |


<a id="d0e1332"/>

### 3.3.3. Examples

<a id="d0e1334"/>

#### 3.3.3.1. Example

```
$ xstructural format file.xml other.xml
$ echo $?
0

$ xstructural format --sourceFile file.xml
$ echo $?
0
```


<a id="d0e1341"/>

## 3.4. Markdown

<a id="d0e1343"/>

### 3.4.1. Name

**markdown** - Transform a structural document to Markdown

<a id="d0e1351"/>

### 3.4.2. Description

The **markdown** command transforms the given input document into a single Markdown document, written to **index.md** in the output directory.

Files referenced by the document, such as images, are copied into the output directory so that the image links in the produced document are resolvable.

The rendered document places all footnotes in a single trailing section at the end of the file, with footnote numbering that is global across the whole document.

<a id="d0e1366"/>

#### 3.4.2.4. Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| **--messagesFile** | Path | false | A file that will contain XSLT debugging messages. |
 | **--traceFile** | Path | false | A file that will contain XSLT trace messages. |
 | **--sourceFile** | Path | true | The path to the input document. |
 | **--typeFile** | Path | false | The path to the type description file. |
 | **--outputDirectory** | Path | true | The directory to which output files will be written. |


<a id="d0e1450"/>

### 3.4.3. Examples

<a id="d0e1452"/>

#### 3.4.3.1. Example

```
$ xstructural markdown \
  --sourceFile com.io7m.xstructural.documentation/target/documentation/main.xml \
  --outputDirectory out
xstructural: XSValidator: INFO: validate (xstructural) /home/user/xstructural/com.io7m.xstructural.documentation/target/documentation/main.xml
xstructural: XSTransformer: INFO: document uses namespace urn:com.io7m.structural:9:0

$ ls -alF out/
total 440
drwxr-xr-x  2 xs xs     60 Oct  2 16:25 ./
drwxr-xr-x 15 xs xs    320 Oct  2 16:25 ../
-rw-r--r--  1 xs xs 149120 Oct  2 16:25 index.md
-rw-r--r--  1 xs xs    515 Oct  2 16:25 messages.log
-rw-r--r--  1 xs xs 287760 Oct  2 16:25 trace.xml
```


<a id="d0e1459"/>

## 3.5. Schema

<a id="d0e1461"/>

### 3.5.1. Name

**schema** - Export schemas

<a id="d0e1469"/>

### 3.5.2. Description

The **schema** command exports the Structural schema files into a specified directory.

<a id="d0e1477"/>

#### 3.5.2.2. Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| **--outputDirectory** | Path | true | The path to the output directory. |
 | **--replace** | Boolean | false | If set to **true**, any existing files will be replaced. |


<a id="d0e1525"/>

### 3.5.3. Examples

<a id="d0e1527"/>

#### 3.5.3.1. Example

```
$ xstructural schema --outputDirectory xsd

$ ls -alF xsd/
total 120
drwxr-xr-x  2 xs xs    141 Apr 28 09:59 ./
drwxr-xr-x 13 xs xs     17 Apr 28 09:59 ../
-rw-r--r--  1 xs xs   4949 Apr 28 09:59 dc.xsd
-rw-r--r--  1 xs xs   4726 Apr 28 09:59 xml.xsd
-rw-r--r--  1 xs xs  31534 Apr 28 09:59 xstructural-7.xsd
-rw-r--r--  1 xs xs   2174 Apr 28 09:59 xstructural-8-index.xsd
-rw-r--r--  1 xs xs  32555 Apr 28 09:59 xstructural-8.xsd
-rw-r--r--  1 xs xs  32868 Apr 28 09:59 xstructural-9.xsd

$ xstructural schema --outputDirectory xsd
xstructural: XSCommandSchema: INFO: output file /home/user/xstructural/xsd/dc.xsd already exists, ignoring
xstructural: XSCommandSchema: INFO: output file /home/user/xstructural/xsd/xml.xsd already exists, ignoring
xstructural: XSCommandSchema: INFO: output file /home/user/xstructural/xsd/xstructural-7.xsd already exists, ignoring
xstructural: XSCommandSchema: INFO: output file /home/user/xstructural/xsd/xstructural-8.xsd already exists, ignoring
xstructural: XSCommandSchema: INFO: output file /home/user/xstructural/xsd/xstructural-9.xsd already exists, ignoring
xstructural: XSCommandSchema: INFO: output file /home/user/xstructural/xsd/xstructural-8-index.xsd already exists, ignoring

$ echo hello > xsd/xstructural-9.xsd

$ ls -alF xsd/
total 120
drwxr-xr-x  2 xs xs    141 Apr 28 09:59 ./
drwxr-xr-x 13 xs xs     17 Apr 28 09:59 ../
-rw-r--r--  1 xs xs   4949 Apr 28 09:59 dc.xsd
-rw-r--r--  1 xs xs   4726 Apr 28 09:59 xml.xsd
-rw-r--r--  1 xs xs  31534 Apr 28 09:59 xstructural-7.xsd
-rw-r--r--  1 xs xs   2174 Apr 28 09:59 xstructural-8-index.xsd
-rw-r--r--  1 xs xs  32555 Apr 28 09:59 xstructural-8.xsd
-rw-r--r--  1 xs xs      6 Apr 28 10:13 xstructural-9.xsd

$ xstructural schema --outputDirectory xsd --replace true

$ ls -alF xsd/
total 120
drwxr-xr-x  2 xs xs    141 Apr 28 10:14 ./
drwxr-xr-x 13 xs xs     17 Apr 28 10:10 ../
-rw-r--r--  1 xs xs   4949 Apr 28 10:14 dc.xsd
-rw-r--r--  1 xs xs   4726 Apr 28 10:14 xml.xsd
-rw-r--r--  1 xs xs  31534 Apr 28 10:14 xstructural-7.xsd
-rw-r--r--  1 xs xs   2174 Apr 28 10:14 xstructural-8-index.xsd
-rw-r--r--  1 xs xs  32555 Apr 28 10:14 xstructural-8.xsd
-rw-r--r--  1 xs xs  32868 Apr 28 10:14 xstructural-9.xsd
```


<a id="d0e1535"/>

## 3.6. Validate

<a id="d0e1537"/>

### 3.6.1. Name

**validate** - Validate input documents

<a id="d0e1545"/>

### 3.6.2. Description

The **validate** command validates a given document against the Structural schema.

<a id="d0e1553"/>

#### 3.6.2.2. Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| **--sourceFile** | Path | true | The path to the input document. |
 | **--typeFile** | Path | false | The path to the type description file. |


<a id="d0e1597"/>

### 3.6.3. Examples

<a id="d0e1599"/>

#### 3.6.3.1. Example

```
$ xstructural validate --sourceFile com.io7m.xstructural.documentation/target/documentation/main.xml
xstructural: XSValidator: INFO: validate (xstructural) /home/user/xstructural/com.io7m.xstructural.documentation/target/documentation/main.xml

$ echo $?
0

$ xstructural validate --sourceFile README-CHANGES.xml
xstructural: XSValidator: INFO: validate (xstructural) /home/user/xstructural/README-CHANGES.xml
xstructural: validation: ERROR: file:///home/user/xstructural/README-CHANGES.xml:2:82: cvc-elt.1.a: Cannot find the declaration of element 'c:changelog'.
xstructural: XSValidator: ERROR: one or more validation errors occurred
xstructural: Main: ERROR: com.io7m.xstructural.api.XSValidationException: Document /home/user/xstructural/README-CHANGES.xml is not a valid structural document

$ echo $?
1
```


<a id="d0e1606"/>

## 3.7. Validate-XHTML

<a id="d0e1608"/>

### 3.7.1. Name

**validate-xhtml** - Validate XHTML

<a id="d0e1616"/>

### 3.7.2. Description

The **validate-xhtml** command validates XHTML pages. The command performs validation against a published XHTML 1.1 XSD schema, and also performs extra integrity checking for internal links.

<a id="d0e1624"/>

#### 3.7.2.2. Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| **--sourceDirectory** | Path | true | The directory containing XHTML files. |


<a id="d0e1655"/>

### 3.7.3. Examples

<a id="d0e1657"/>

#### 3.7.3.1. Example

```
$ xstructural validate-xhtml \
  --sourceDirectory out
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/index.xhtml
```


<a id="d0e1663"/>

### 3.7.4. History

The **validate-xhtml** command was added in **xstructural 1.3.0**.

<a id="d0e1676"/>

## 3.8. XHTML

<a id="d0e1678"/>

### 3.8.1. Name

**xhtml** - Produce XHTML

<a id="d0e1686"/>

### 3.8.2. Description

The **xhtml** command produces XHTML pages for the given input document.

<a id="d0e1694"/>

#### 3.8.2.2. Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| **--brandingFile** | Path | false | The path to the branding document. |
 | **--copyResources** | Boolean | false | If set to **true**, resources such as the default Structural CSS files will be copied to the output directory. |
 | **--messagesFile** | Path | false | A file that will contain XSLT debugging messages. |
 | **--traceFile** | Path | false | A file that will contain XSLT trace messages. |
 | **--typeFile** | Path | false | The path to the type description file. |
 | **--sourceFile** | Path | true | The path to the input document. |
 | **--outputDirectory** | Path | true | The directory to which output files will be written. |
 | **--stylesheet** | Stylesheet | false | The XSLT stylesheet that will be used. |


<a id="d0e1821"/>

### 3.8.3. Examples

<a id="d0e1823"/>

#### 3.8.3.1. Example

```
$ xstructural xhtml \
  --sourceFile com.io7m.xstructural.documentation/target/documentation/main.xml \
  --stylesheet SINGLE_FILE \
  --outputDirectory out
xstructural: XSValidator: INFO: validate (xstructural) /home/user/xstructural/com.io7m.xstructural.documentation/target/documentation/main.xml
xstructural: XSTransformer: INFO: copy resource reset.css
xstructural: XSTransformer: INFO: copy resource structural.css
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/index.xhtml

$ ls -alF out/
total 116
drwxr-xr-x  2 xs xs  4096 Apr 28 10:26 ./
drwxr-xr-x 14 xs xs  4096 Apr 28 10:26 ../
-rw-r--r--  1 xs xs 30783 Apr 28 10:26 index.xhtml
-rw-r--r--  1 xs xs   272 Apr 28 10:26 messages.log
-rw-r--r--  1 xs xs  6138 Apr 28 10:26 reset.css
-rw-r--r--  1 xs xs  6881 Apr 28 10:26 structural.css
-rw-r--r--  1 xs xs 57239 Apr 28 10:26 trace.xml

$ xstructural xhtml \
  --sourceFile com.io7m.xstructural.documentation/target/documentation/main.xml \
  --stylesheet MULTIPLE_FILE \
  --outputDirectory out
xstructural: XSValidator: INFO: validate (xstructural) /home/user/xstructural/com.io7m.xstructural.documentation/target/documentation/main.xml
xstructural: XSTransformer: INFO: copy resource reset.css
xstructural: XSTransformer: INFO: copy resource structural.css
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e104.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e298.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e300.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e12.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e163.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e28.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/index-m.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/index.xhtml
xstructural: XSXHTMLValidator: INFO: validate (xhtml 1.1) out/d2e14.xhtml

$ ls -alF out/
total 172
drwxr-xr-x  2 xs xs  4096 Apr 28 10:35 ./
drwxr-xr-x 14 xs xs  4096 Apr 28 10:26 ../
-rw-r--r--  1 xs xs  7187 Apr 28 10:35 d2e104.xhtml
-rw-r--r--  1 xs xs  5251 Apr 28 10:35 d2e12.xhtml
-rw-r--r--  1 xs xs  5914 Apr 28 10:35 d2e14.xhtml
-rw-r--r--  1 xs xs  7405 Apr 28 10:35 d2e163.xhtml
-rw-r--r--  1 xs xs  8016 Apr 28 10:35 d2e28.xhtml
-rw-r--r--  1 xs xs  3175 Apr 28 10:35 d2e298.xhtml
-rw-r--r--  1 xs xs  3366 Apr 28 10:35 d2e300.xhtml
-rw-r--r--  1 xs xs  5746 Apr 28 10:35 index-m.xhtml
-rw-r--r--  1 xs xs 30783 Apr 28 10:26 index.xhtml
-rw-r--r--  1 xs xs     0 Apr 28 10:35 messages.log
-rw-r--r--  1 xs xs  6138 Apr 28 10:35 reset.css
-rw-r--r--  1 xs xs  6881 Apr 28 10:35 structural.css
-rw-r--r--  1 xs xs 60237 Apr 28 10:35 trace.xml
```


<a id="d0e1831"/>

## 4. Maven Plugin

<a id="d0e1833"/>

### 4.1. Overview

The **xstructural** package provides a Maven plugin for transforming documents as part of a Maven build.

<a id="d0e1842"/>

### 4.2. Usage

The Maven plugin has a simple interface that mostly matches the [command-line](#id_41890668-2d97-42e1-aa10-7efc4f36297f) interface.

<a id="d0e1850"/>

#### 4.2.2. POM Definitions

```
<build>
    <plugins>
      ...

      <!-- Generate documentation in various formats. -->
      <plugin>
        <groupId>com.io7m.xstructural</groupId>
        <artifactId>com.io7m.xstructural.maven_plugin</artifactId>
        <version>3.0.0-beta0002</version>
        <executions>
          <execution>
            <id>xhtml-single</id>
            <phase>package</phase>
            <goals>
              <goal>xhtml-single</goal>
            </goals>
            <configuration>
              <brandingFile>src/main/xml/brand.xml</brandingFile>
              <sourceFile>src/main/xml/main.xml</sourceFile>
              <outputDirectory>target/documentation</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>xhtml-multi</id>
            <phase>package</phase>
            <goals>
              <goal>xhtml-multi</goal>
            </goals>
            <configuration>
              <brandingFile>src/main/xml/brand.xml</brandingFile>
              <sourceFile>src/main/xml/main.xml</sourceFile>
              <outputDirectory>target/documentation</outputDirectory>
              <typeFile>src/main/xml/types.xml</typeFile>
            </configuration>
          </execution>
          <execution>
            <id>epub</id>
            <phase>package</phase>
            <goals>
              <goal>epub</goal>
            </goals>
            <configuration>
              <brandingFile>src/main/xml/brand.xml</brandingFile>
              <sourceFile>src/main/xml/main.xml</sourceFile>
              <outputDirectory>target/epub</outputDirectory>
              <outputFileName>documentation.epub</outputFileName>
            </configuration>
          </execution>
          <execution>
            <id>markdown</id>
            <phase>package</phase>
            <goals>
              <goal>markdown</goal>
            </goals>
            <configuration>
              <sourceFile>src/main/xml/main.xml</sourceFile>
              <outputDirectory>target/markdown</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>
```


<a id="d0e1856"/>

### 4.3. Skipping

Execution of the plugin may be skipped by setting the **xstructural.skip** system property to **true**.

<a id="d0e1868"/>

### 4.4. Format

The **format** goal formats structural files in place. Files are selected with an Ant-style **glob** pattern, matched relative to the **baseDirectory** (defaulting to the project basedir). The maximum line width is configurable with **maxWidth** (defaulting to 120).

<a id="d0e1885"/>

#### 4.4.2. Example

```
<plugin>
  <groupId>com.io7m.xstructural</groupId>
  <artifactId>com.io7m.xstructural.maven_plugin</artifactId>
  <version>3.0.0-beta0002</version>
  <executions>
    <execution>
      <id>format</id>
      <goals>
        <goal>format</goal>
      </goals>
      <configuration>
        <glob>**/*.xml</glob>
      </configuration>
    </execution>
  </executions>
</plugin>
```


<a id="d0e1893"/>

## 5. API

<a id="d0e1895"/>

### 5.1. Usage

<a id="d0e1897"/>

#### 5.1.1. Usage

```
var factory =
  ServiceLoader.load(XSProcessorFactoryType.class)
    .findFirst()
    .orElseThrow(() -> new IllegalStateException("Missing factory service"));

final var request =
  XSProcessorRequest.builder()
    .setOutputDirectory(Paths.get(...))
    .setSourceFile(Paths.get(...))
    .setTask(Task.TRANSFORM_XHTML)
    .setStylesheet(Stylesheet.SINGLE_FILE)
    .build();

final var processor = processors.create(request);
processor.execute();
```


<a id="d0e1903"/>

### 5.2. JavaDoc

Please see the included [JavaDoc](https://www.io7m.com/software/xstructural/documentation/apidocs) for API reference documentation.

<a id="id_3c28e89e-a225-46ba-bbc5-5c989425a509"/>

## 6. Schema

The **structural** language is defined by a strict XSD schema. Documents not conforming to the schema MUST be rejected by renderers.

<a id="d0e1921"/>

#### 6.2. xstructural 9.0 Schema

```
<?xml version="1.0" encoding="UTF-8" ?>

<!--
  Copyright © 2026 Mark Raynsford <code@io7m.com> https://www.io7m.com

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted, provided that the above
  copyright notice and this permission notice appear in all copies.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
  IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            xmlns:dc="http://purl.org/dc/elements/1.1/"
            xmlns:s="urn:com.io7m.structural:9:0"
            targetNamespace="urn:com.io7m.structural:9:0">

  <xsd:import namespace="http://purl.org/dc/elements/1.1/"
              schemaLocation="dc.xsd"/>
  <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
              schemaLocation="xml.xsd"/>

  <xsd:simpleType name="uuidType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A UUID value.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="imageTextType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of text that appears in image elements. This is required to be of non-zero length in order to ensure
        that authors add useful text that will then be used in the 'alt' elements of XHTML generated from the document
        sources.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="1"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="typeType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of type names. Type names are used to categorize elements and are somewhat analogous to CSS classes,
        except that they are intended to be used for more than just styling documents.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z][a-zA-Z0-9_\.\-]*"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:attributeGroup name="standardXMLAttributes">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The standard elements expected to appear in XML texts.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:attribute ref="xml:base"/>
    <xsd:attribute ref="xml:lang"/>
  </xsd:attributeGroup>

  <xsd:attributeGroup name="tableOfContentAttributes">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The attributes used to describe tables of content.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attribute name="tableOfContents"
                   use="optional"
                   default="true"
                   type="xsd:boolean">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          If the value of the attribute is 'true', then a table of contents will be generated in the respective element.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="tableOfContentsDepth"
                   use="optional"
                   default="3"
                   type="xsd:positiveInteger">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The maximum relative depth of sections and subsections that will appear in a generated table of contents.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:attributeGroup>

  <xsd:complexType mixed="true"
                   name="ImageType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An element used to describe an image. The text content of the image element SHOULD be used to provide an
        accessible description of the image. This description is expected to be used by screen readers, and may also be
        displayed by browsers if the referenced image cannot be loaded for any reason.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:simpleContent>
      <xsd:extension base="s:imageTextType">
        <xsd:attributeGroup ref="s:standardXMLAttributes"/>

        <xsd:attribute name="type"
                       type="s:typeType"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The type of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="width"
                       type="xsd:nonNegativeInteger"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The width of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="height"
                       type="xsd:nonNegativeInteger"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The height of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="source"
                       type="xsd:anyURI"
                       use="required">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The source location of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:element name="Image"
               type="s:ImageType"/>

  <xsd:complexType name="ItemType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An item appearing in a list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:ListContent"/>
    </xsd:sequence>
    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Item"
               type="s:ItemType"/>

  <xsd:group name="ListContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The elements that may appear in list items.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="ListOrderedType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An ordered list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Item"/>
    </xsd:sequence>
    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="ListOrdered"
               type="s:ListOrderedType"/>

  <xsd:complexType name="ListUnorderedType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An unordered list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Item"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="ListUnordered"
               type="s:ListUnorderedType"/>

  <xsd:complexType name="ColumnType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A description of a column in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the column.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Column"
               type="s:ColumnType"/>

  <xsd:complexType name="ColumnsType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A set of table column descriptions.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Column"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the columns.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Columns"
               type="s:ColumnsType"/>

  <xsd:group name="TableContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that may appear in table cells.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="CellType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A cell in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:TableContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the cell.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Cell"
               type="s:CellType"/>

  <xsd:complexType name="RowType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A row of cells in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Cell"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the row.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the table row.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Row"
               type="s:RowType"/>

  <xsd:complexType name="TableType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A table. A table consists of a list of column definitions, followed by a sequence of rows consisting of the
        table cells.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element ref="s:Columns"/>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Row"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the table row.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Table"
               type="s:TableType"/>

  <xsd:complexType name="TermType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A term acts as a simple container of one or more words in a sentence. Term elements can be used to denote the
        semantics of words, such as wrapping the name of a mathematical function in a &lt;Term type="function"&gt;
        element.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:typeType"
                   name="type"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the term.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Term"
               type="s:TermType"/>

  <xsd:complexType name="LinkType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Link element describes a link to an element within the current document. Links may only refer to elements that
        contain an appropriate 'id' attribute.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:uuidType"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target of the link, which must be an element with an appropriate 'id' attribute.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Link"
               type="s:LinkType"/>

  <xsd:complexType name="LinkFootnoteType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A LinkFootnote element describes a link to a footnote within the current section.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:uuidType"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target of the link, which must be a Footnote with a matching 'id' attribute.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="LinkFootnote"
               type="s:LinkFootnoteType"/>

  <xsd:complexType name="LinkExternalType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A LinkExternal element describes a link to an external URI.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="xsd:anyURI"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target URI.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="LinkExternal"
               type="s:LinkExternalType"/>

  <xsd:complexType name="VerbatimType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Verbatim element contains text that should be reproduced exactly, with almost all whitespace intact. Renderers
        are permitted to trim leading and trailing whitespace.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the verbatim text.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Verbatim"
               type="s:VerbatimType"/>

  <xsd:group name="FormalItemContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that can appear in formal items.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Table"/>
      <xsd:element ref="s:Term"/>
      <xsd:element ref="s:Verbatim"/>
    </xsd:choice>
  </xsd:group>

  <xsd:group name="ParagraphContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that can appear in paragraphs.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:simpleType name="MetaPropertyNameType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of meta property names.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="([a-z0-9_\-]+)(.([a-z0-9_\-]+))+"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="MetaPropertyType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A metadata property.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attribute name="name"
                   use="required"
                   type="s:MetaPropertyNameType"/>
    <xsd:attribute name="visible"
                   use="optional"
                   default="false"
                   type="xsd:boolean"/>
  </xsd:complexType>

  <xsd:element name="MetaProperty"
               type="s:MetaPropertyType"/>

  <xsd:complexType name="MetadataType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An element containing document metadata.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:group ref="dc:elementsGroup"/>
      <xsd:sequence minOccurs="0"
                    maxOccurs="unbounded">
        <xsd:element ref="s:MetaProperty"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
  </xsd:complexType>

  <xsd:element name="Metadata"
               type="s:MetadataType"/>

  <xsd:complexType name="ParagraphType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A paragraph denotes a self-contained series of sentences.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:ParagraphContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the paragraph.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional"/>
  </xsd:complexType>

  <xsd:element name="Paragraph"
               type="s:ParagraphType"/>

  <xsd:complexType name="FormalItemType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A formal item is analogous to a "figure" in printed text. Formal items are used to significant images, tables of
        data, code listings, and other important objects into texts. They are considered to be at the same level of
        structural significance as paragraphs.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:group ref="s:FormalItemContent"/>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="FormalItem"
               type="s:FormalItemType"/>

  <xsd:group name="SubsectionContent">
    <xsd:choice>
      <xsd:element ref="s:Paragraph"/>
      <xsd:element ref="s:FormalItem"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="SubsectionType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Subsection is a structural element that denotes a part of the document similar to a chapter.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Subsection"/>
      </xsd:sequence>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:group ref="s:SubsectionContent"/>
      </xsd:sequence>
    </xsd:choice>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Subsection"
               type="s:SubsectionType"/>

  <xsd:group name="FootnoteContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that may appear in footnotes.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Table"/>
      <xsd:element ref="s:Term"/>
      <xsd:element ref="s:Verbatim"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="FootnoteType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Footnote is a note of referenc or comment usually placed at the bottom of a page. Footnotes may be referenced
        by LinkFootnote elements.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:FootnoteContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the footnote.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Footnote"
               type="s:FootnoteType"/>

  <xsd:complexType name="SectionType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Section is a structural element that denotes a part of the document similar to a chapter. Renderers that
        produce multiple pages MUST insert whatever is analogous to a page break at the end of a section.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:choice>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Section"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Subsection"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:group ref="s:SubsectionContent"/>
        </xsd:sequence>
      </xsd:choice>
      <xsd:sequence minOccurs="0"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Footnote"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attributeGroup ref="s:tableOfContentAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Section"
               type="s:SectionType">

    <xsd:unique name="SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnotes within a section must have unique identifiers.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Footnote"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="SectionFootnoteReferencesParagraph"
                refer="s:SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote links in paragraphs must refer to footnotes that exist in this section.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Paragraph/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>

    <xsd:keyref name="SectionFootnoteReferencesSubsection"
                refer="s:SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote links in subsections must refer to footnotes that exist in this section.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Subsection/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>
  </xsd:element>

  <xsd:complexType name="DocumentType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The Document element represents the top-level structure of a document. The name 'document' is somewhat of a
        misnomer, as nothing prevents the document from being structured as a book (with chapters, etc). The document
        begins with standard Dublin Core metadata, and contains _either_ a series of sections _or_ a series of
        subsections (but not both).
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element ref="s:Metadata"/>
      <xsd:choice>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Section"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Subsection"/>
        </xsd:sequence>
      </xsd:choice>
      <xsd:sequence minOccurs="0"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Footnote"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attributeGroup ref="s:tableOfContentAttributes"/>
  </xsd:complexType>

  <xsd:element name="Document"
               type="s:DocumentType">
    <xsd:unique name="ItemIDsAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on objects within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:FormalItem|.//s:Paragraph|.//s:Subsection|.//s:Section|.//s:Footnote|.//s:Row"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:unique name="LinkReferencesAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on objects within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:FormalItem|.//s:Paragraph|.//s:Subsection|.//s:Section|.//s:Row"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="LinkReferences"
                refer="s:LinkReferencesAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All Link elements must refer to elements with existing 'id' attributes.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:Link"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>

    <xsd:unique name="DocumentFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on footnotes within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath="s:Footnote"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="DocumentFootnoteReferences"
                refer="s:DocumentFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote references must refer to footnotes that exist.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath="s:Subsection/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>
  </xsd:element>

</xsd:schema>
```


<a id="d0e1926"/>

#### 6.3. xstructural 8.0 Schema

```
<?xml version="1.0" encoding="UTF-8" ?>

<!--
  Copyright © 2021 Mark Raynsford <code@io7m.com> https://www.io7m.com

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted, provided that the above
  copyright notice and this permission notice appear in all copies.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
  IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            xmlns:dc="http://purl.org/dc/elements/1.1/"
            xmlns:s="urn:com.io7m.structural:8:0"
            targetNamespace="urn:com.io7m.structural:8:0">

  <xsd:import namespace="http://purl.org/dc/elements/1.1/"
              schemaLocation="dc.xsd"/>
  <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
              schemaLocation="xml.xsd"/>

  <xsd:simpleType name="uuidType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A UUID value.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="imageTextType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of text that appears in image elements. This is required to be of non-zero length in order to ensure
        that authors add useful text that will then be used in the 'alt' elements of XHTML generated from the document
        sources.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="1"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="typeType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of type names. Type names are used to categorize elements and are somewhat analogous to CSS classes,
        except that they are intended to be used for more than just styling documents.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z][a-zA-Z0-9_\.\-]*"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:attributeGroup name="standardXMLAttributes">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The standard elements expected to appear in XML texts.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:attribute ref="xml:base"/>
    <xsd:attribute ref="xml:lang"/>
  </xsd:attributeGroup>

  <xsd:attributeGroup name="tableOfContentAttributes">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The attributes used to describe tables of content.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attribute name="tableOfContents"
                   use="optional"
                   default="true"
                   type="xsd:boolean">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          If the value of the attribute is 'true', then a table of contents will be generated in the respective element.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="tableOfContentsDepth"
                   use="optional"
                   default="3"
                   type="xsd:positiveInteger">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The maximum relative depth of sections and subsections that will appear in a generated table of contents.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:attributeGroup>

  <xsd:complexType mixed="true"
                   name="ImageType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An element used to describe an image. The text content of the image element SHOULD be used to provide an
        accessible description of the image. This description is expected to be used by screen readers, and may also be
        displayed by browsers if the referenced image cannot be loaded for any reason.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:simpleContent>
      <xsd:extension base="s:imageTextType">
        <xsd:attributeGroup ref="s:standardXMLAttributes"/>

        <xsd:attribute name="type"
                       type="s:typeType"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The type of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="width"
                       type="xsd:nonNegativeInteger"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The width of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="height"
                       type="xsd:nonNegativeInteger"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The height of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="source"
                       type="xsd:anyURI"
                       use="required">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The source location of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:element name="Image"
               type="s:ImageType"/>

  <xsd:complexType name="ItemType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An item appearing in a list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:ListContent"/>
    </xsd:sequence>
    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Item"
               type="s:ItemType"/>

  <xsd:group name="ListContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The elements that may appear in list items.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="ListOrderedType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An ordered list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Item"/>
    </xsd:sequence>
    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="ListOrdered"
               type="s:ListOrderedType"/>

  <xsd:complexType name="ListUnorderedType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An unordered list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Item"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="ListUnordered"
               type="s:ListUnorderedType"/>

  <xsd:complexType name="ColumnType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A description of a column in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the column.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Column"
               type="s:ColumnType"/>

  <xsd:complexType name="ColumnsType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A set of table column descriptions.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Column"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the columns.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Columns"
               type="s:ColumnsType"/>

  <xsd:group name="TableContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that may appear in table cells.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="CellType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A cell in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:TableContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the cell.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Cell"
               type="s:CellType"/>

  <xsd:complexType name="RowType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A row of cells in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Cell"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the row.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Row"
               type="s:RowType"/>

  <xsd:complexType name="TableType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A table. A table consists of a list of column definitions, followed by a sequence of rows consisting of the
        table cells.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element ref="s:Columns"/>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Row"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the table.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Table"
               type="s:TableType"/>

  <xsd:complexType name="TermType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A term acts as a simple container of one or more words in a sentence. Term elements can be used to denote the
        semantics of words, such as wrapping the name of a mathematical function in a &lt;Term type="function"&gt;
        element.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:typeType"
                   name="type"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the term.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Term"
               type="s:TermType"/>

  <xsd:complexType name="LinkType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Link element describes a link to an element within the current document. Links may only refer to elements that
        contain an appropriate 'id' attribute.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:uuidType"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target of the link, which must be an element with an appropriate 'id' attribute.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Link"
               type="s:LinkType"/>

  <xsd:complexType name="LinkFootnoteType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A LinkFootnote element describes a link to a footnote within the current section.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:uuidType"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target of the link, which must be a Footnote with a matching 'id' attribute.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="LinkFootnote"
               type="s:LinkFootnoteType"/>

  <xsd:complexType name="LinkExternalType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A LinkExternal element describes a link to an external URI.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="xsd:anyURI"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target URI.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="LinkExternal"
               type="s:LinkExternalType"/>

  <xsd:complexType name="VerbatimType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Verbatim element contains text that should be reproduced exactly, with almost all whitespace intact. Renderers
        are permitted to trim leading and trailing whitespace.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the verbatim text.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Verbatim"
               type="s:VerbatimType"/>

  <xsd:group name="FormalItemContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that can appear in formal items.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Table"/>
      <xsd:element ref="s:Term"/>
      <xsd:element ref="s:Verbatim"/>
    </xsd:choice>
  </xsd:group>

  <xsd:group name="ParagraphContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that can appear in paragraphs.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:simpleType name="MetaPropertyNameType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of meta property names.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="([a-z0-9_\-]+)(.([a-z0-9_\-]+))+"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="MetaPropertyType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A metadata property.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attribute name="name"
                   use="required"
                   type="s:MetaPropertyNameType"/>
    <xsd:attribute name="visible"
                   use="optional"
                   default="false"
                   type="xsd:boolean"/>
  </xsd:complexType>

  <xsd:element name="MetaProperty"
               type="s:MetaPropertyType"/>

  <xsd:complexType name="MetadataType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An element containing document metadata.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:group ref="dc:elementsGroup"/>
      <xsd:sequence minOccurs="0"
                    maxOccurs="unbounded">
        <xsd:element ref="s:MetaProperty"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
  </xsd:complexType>

  <xsd:element name="Metadata"
               type="s:MetadataType"/>

  <xsd:complexType name="ParagraphType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A paragraph denotes a self-contained series of sentences.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:ParagraphContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the paragraph.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional"/>
  </xsd:complexType>

  <xsd:element name="Paragraph"
               type="s:ParagraphType"/>

  <xsd:complexType name="FormalItemType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A formal item is analogous to a "figure" in printed text. Formal items are used to significant images, tables of
        data, code listings, and other important objects into texts. They are considered to be at the same level of
        structural significance as paragraphs.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:group ref="s:FormalItemContent"/>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="FormalItem"
               type="s:FormalItemType"/>

  <xsd:group name="SubsectionContent">
    <xsd:choice>
      <xsd:element ref="s:Paragraph"/>
      <xsd:element ref="s:FormalItem"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="SubsectionType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Subsection is a structural element that denotes a part of the document similar to a chapter.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Subsection"/>
      </xsd:sequence>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:group ref="s:SubsectionContent"/>
      </xsd:sequence>
    </xsd:choice>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Subsection"
               type="s:SubsectionType"/>

  <xsd:group name="FootnoteContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that may appear in footnotes.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Table"/>
      <xsd:element ref="s:Term"/>
      <xsd:element ref="s:Verbatim"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="FootnoteType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Footnote is a note of referenc or comment usually placed at the bottom of a page. Footnotes may be referenced
        by LinkFootnote elements.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:FootnoteContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the footnote.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Footnote"
               type="s:FootnoteType"/>

  <xsd:complexType name="SectionType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Section is a structural element that denotes a part of the document similar to a chapter. Renderers that
        produce multiple pages MUST insert whatever is analogous to a page break at the end of a section.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:choice>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Section"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Subsection"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:group ref="s:SubsectionContent"/>
        </xsd:sequence>
      </xsd:choice>
      <xsd:sequence minOccurs="0"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Footnote"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attributeGroup ref="s:tableOfContentAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Section"
               type="s:SectionType">

    <xsd:unique name="SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnotes within a section must have unique identifiers.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Footnote"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="SectionFootnoteReferencesParagraph"
                refer="s:SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote links in paragraphs must refer to footnotes that exist in this section.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Paragraph/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>

    <xsd:keyref name="SectionFootnoteReferencesSubsection"
                refer="s:SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote links in subsections must refer to footnotes that exist in this section.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Subsection/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>
  </xsd:element>

  <xsd:complexType name="DocumentType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The Document element represents the top-level structure of a document. The name 'document' is somewhat of a
        misnomer, as nothing prevents the document from being structured as a book (with chapters, etc). The document
        begins with standard Dublin Core metadata, and contains _either_ a series of sections _or_ a series of
        subsections (but not both).
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element ref="s:Metadata"/>
      <xsd:choice>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Section"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Subsection"/>
        </xsd:sequence>
      </xsd:choice>
      <xsd:sequence minOccurs="0"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Footnote"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attributeGroup ref="s:tableOfContentAttributes"/>
  </xsd:complexType>

  <xsd:element name="Document"
               type="s:DocumentType">
    <xsd:unique name="ItemIDsAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on objects within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:FormalItem|.//s:Paragraph|.//s:Subsection|.//s:Section|.//s:Footnote"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:unique name="LinkReferencesAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on objects within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:FormalItem|.//s:Paragraph|.//s:Subsection|.//s:Section"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="LinkReferences"
                refer="s:LinkReferencesAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All Link elements must refer to elements with existing 'id' attributes.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:Link"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>

    <xsd:unique name="DocumentFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on footnotes within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath="s:Footnote"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="DocumentFootnoteReferences"
                refer="s:DocumentFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote references must refer to footnotes that exist.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath="s:Subsection/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>
  </xsd:element>

</xsd:schema>
```


<a id="d0e1931"/>

#### 6.4. xstructural 7.0 Schema

```
<?xml version="1.0" encoding="UTF-8" ?>

<!--
  Copyright © 2021 Mark Raynsford <code@io7m.com> https://www.io7m.com

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted, provided that the above
  copyright notice and this permission notice appear in all copies.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
  IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            xmlns:dc="http://purl.org/dc/elements/1.1/"
            xmlns:s="urn:com.io7m.structural:7:0"
            targetNamespace="urn:com.io7m.structural:7:0">

  <xsd:import namespace="http://purl.org/dc/elements/1.1/"
              schemaLocation="dc.xsd"/>
  <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
              schemaLocation="xml.xsd"/>

  <xsd:simpleType name="uuidType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A UUID value.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="imageTextType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of text that appears in image elements. This is required to be of non-zero length in order to ensure
        that authors add useful text that will then be used in the 'alt' elements of XHTML generated from the document
        sources.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="1"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="typeType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of type names. Type names are used to categorize elements and are somewhat analogous to CSS classes,
        except that they are intended to be used for more than just styling documents.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z][a-zA-Z0-9_\.\-]*"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:attributeGroup name="standardXMLAttributes">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The standard elements expected to appear in XML texts.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:attribute ref="xml:base"/>
    <xsd:attribute ref="xml:lang"/>
  </xsd:attributeGroup>

  <xsd:attributeGroup name="tableOfContentAttributes">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The attributes used to describe tables of content.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attribute name="tableOfContents"
                   use="optional"
                   default="true"
                   type="xsd:boolean">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          If the value of the attribute is 'true', then a table of contents will be generated in the respective element.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="tableOfContentsDepth"
                   use="optional"
                   default="3"
                   type="xsd:positiveInteger">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The maximum relative depth of sections and subsections that will appear in a generated table of contents.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:attributeGroup>

  <xsd:complexType mixed="true"
                   name="ImageType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An element used to describe an image. The text content of the image element SHOULD be used to provide an
        accessible description of the image. This description is expected to be used by screen readers, and may also be
        displayed by browsers if the referenced image cannot be loaded for any reason.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:simpleContent>
      <xsd:extension base="s:imageTextType">
        <xsd:attributeGroup ref="s:standardXMLAttributes"/>

        <xsd:attribute name="type"
                       type="s:typeType"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The type of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="width"
                       type="xsd:nonNegativeInteger"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The width of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="height"
                       type="xsd:nonNegativeInteger"
                       use="optional">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The height of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="source"
                       type="xsd:anyURI"
                       use="required">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The source location of the image.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:element name="Image"
               type="s:ImageType"/>

  <xsd:complexType name="ItemType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An item appearing in a list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:ListContent"/>
    </xsd:sequence>
    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Item"
               type="s:ItemType"/>

  <xsd:group name="ListContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The elements that may appear in list items.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="ListOrderedType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An ordered list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Item"/>
    </xsd:sequence>
    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="ListOrdered"
               type="s:ListOrderedType"/>

  <xsd:complexType name="ListUnorderedType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An unordered list.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Item"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the list.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="ListUnordered"
               type="s:ListUnorderedType"/>

  <xsd:complexType name="ColumnType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A description of a column in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the column.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Column"
               type="s:ColumnType"/>

  <xsd:complexType name="ColumnsType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A set of table column descriptions.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Column"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the columns.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Columns"
               type="s:ColumnsType"/>

  <xsd:group name="TableContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that may appear in table cells.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="CellType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A cell in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:TableContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the cell.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Cell"
               type="s:CellType"/>

  <xsd:complexType name="RowType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A row of cells in a table.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="1"
                  maxOccurs="unbounded">
      <xsd:element ref="s:Cell"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the row.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Row"
               type="s:RowType"/>

  <xsd:complexType name="TableType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A table. A table consists of a list of column definitions, followed by a sequence of rows consisting of the
        table cells.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element ref="s:Columns"/>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Row"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the table.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Table"
               type="s:TableType"/>

  <xsd:complexType name="TermType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A term acts as a simple container of one or more words in a sentence. Term elements can be used to denote the
        semantics of words, such as wrapping the name of a mathematical function in a &lt;Term type="function"&gt;
        element.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:typeType"
                   name="type"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the term.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Term"
               type="s:TermType"/>

  <xsd:complexType name="LinkType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Link element describes a link to an element within the current document. Links may only refer to elements that
        contain an appropriate 'id' attribute.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:uuidType"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target of the link, which must be an element with an appropriate 'id' attribute.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Link"
               type="s:LinkType"/>

  <xsd:complexType name="LinkFootnoteType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A LinkFootnote element describes a link to a footnote within the current section.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="s:uuidType"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target of the link, which must be a Footnote with a matching 'id' attribute.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="LinkFootnote"
               type="s:LinkFootnoteType"/>

  <xsd:complexType name="LinkExternalType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A LinkExternal element describes a link to an external URI.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute type="xsd:anyURI"
                   name="target"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The target URI.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the link.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="LinkExternal"
               type="s:LinkExternalType"/>

  <xsd:complexType name="VerbatimType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Verbatim element contains text that should be reproduced exactly, with almost all whitespace intact. Renderers
        are permitted to trim leading and trailing whitespace.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the verbatim text.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Verbatim"
               type="s:VerbatimType"/>

  <xsd:group name="FormalItemContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that can appear in formal items.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Table"/>
      <xsd:element ref="s:Term"/>
      <xsd:element ref="s:Verbatim"/>
    </xsd:choice>
  </xsd:group>

  <xsd:group name="ParagraphContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that can appear in paragraphs.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Term"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="MetadataType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        An element containing document metadata.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:group ref="dc:elementsGroup"/>
    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
  </xsd:complexType>

  <xsd:element name="Metadata"
               type="s:MetadataType"/>

  <xsd:complexType name="ParagraphType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A paragraph denotes a self-contained series of sentences.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:ParagraphContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the paragraph.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional"/>
  </xsd:complexType>

  <xsd:element name="Paragraph"
               type="s:ParagraphType"/>

  <xsd:complexType name="FormalItemType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A formal item is analogous to a "figure" in printed text. Formal items are used to significant images, tables of
        data, code listings, and other important objects into texts. They are considered to be at the same level of
        structural significance as paragraphs.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:group ref="s:FormalItemContent"/>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the formal item.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="FormalItem"
               type="s:FormalItemType"/>

  <xsd:group name="SubsectionContent">
    <xsd:choice>
      <xsd:element ref="s:Paragraph"/>
      <xsd:element ref="s:FormalItem"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="SubsectionType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Subsection is a structural element that denotes a part of the document similar to a chapter.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Subsection"/>
      </xsd:sequence>
      <xsd:sequence minOccurs="1"
                    maxOccurs="unbounded">
        <xsd:group ref="s:SubsectionContent"/>
      </xsd:sequence>
    </xsd:choice>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the subsection.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Subsection"
               type="s:SubsectionType"/>

  <xsd:group name="FootnoteContent">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The type of content that may appear in footnotes.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:choice>
      <xsd:element ref="s:Image"/>
      <xsd:element ref="s:Link"/>
      <xsd:element ref="s:LinkExternal"/>
      <xsd:element ref="s:LinkFootnote"/>
      <xsd:element ref="s:ListOrdered"/>
      <xsd:element ref="s:ListUnordered"/>
      <xsd:element ref="s:Table"/>
      <xsd:element ref="s:Term"/>
      <xsd:element ref="s:Verbatim"/>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="FootnoteType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Footnote is a note of referenc or comment usually placed at the bottom of a page. Footnotes may be referenced
        by LinkFootnote elements.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence minOccurs="0"
                  maxOccurs="unbounded">
      <xsd:group ref="s:FootnoteContent"/>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the footnote.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Footnote"
               type="s:FootnoteType"/>

  <xsd:complexType name="SectionType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A Section is a structural element that denotes a part of the document similar to a chapter. Renderers that
        produce multiple pages MUST insert whatever is analogous to a page break at the end of a section.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:choice>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Section"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Subsection"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:group ref="s:SubsectionContent"/>
        </xsd:sequence>
      </xsd:choice>
      <xsd:sequence minOccurs="0"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Footnote"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attributeGroup ref="s:tableOfContentAttributes"/>

    <xsd:attribute name="type"
                   type="s:typeType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The type of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="id"
                   type="s:uuidType"
                   use="optional">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The unique identifier of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>

    <xsd:attribute name="title"
                   type="xsd:string"
                   use="required">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          The title of the section.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="Section"
               type="s:SectionType">

    <xsd:unique name="SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnotes within a section must have unique identifiers.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Footnote"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="SectionFootnoteReferencesParagraph"
                refer="s:SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote links in paragraphs must refer to footnotes that exist in this section.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Paragraph/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>

    <xsd:keyref name="SectionFootnoteReferencesSubsection"
                refer="s:SectionFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote links in subsections must refer to footnotes that exist in this section.
        </xsd:documentation>
      </xsd:annotation>
      <xsd:selector xpath="s:Subsection/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>
  </xsd:element>

  <xsd:complexType name="DocumentType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The Document element represents the top-level structure of a document. The name 'document' is somewhat of a
        misnomer, as nothing prevents the document from being structured as a book (with chapters, etc). The document
        begins with standard Dublin Core metadata, and contains _either_ a series of sections _or_ a series of
        subsections (but not both).
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element ref="s:Metadata"/>
      <xsd:choice>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Section"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="1"
                      maxOccurs="unbounded">
          <xsd:element ref="s:Subsection"/>
        </xsd:sequence>
      </xsd:choice>
      <xsd:sequence minOccurs="0"
                    maxOccurs="unbounded">
        <xsd:element ref="s:Footnote"/>
      </xsd:sequence>
    </xsd:sequence>

    <xsd:attributeGroup ref="s:standardXMLAttributes"/>
    <xsd:attributeGroup ref="s:tableOfContentAttributes"/>
  </xsd:complexType>

  <xsd:element name="Document"
               type="s:DocumentType">
    <xsd:unique name="ItemIDsAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on objects within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:FormalItem|.//s:Paragraph|.//s:Subsection|.//s:Section|.//s:Footnote"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:unique name="LinkReferencesAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on objects within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:FormalItem|.//s:Paragraph|.//s:Subsection|.//s:Section"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="LinkReferences"
                refer="s:LinkReferencesAreUnique">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All Link elements must refer to elements with existing 'id' attributes.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath=".//s:Link"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>

    <xsd:unique name="DocumentFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All 'id' attributes specified on footnotes within the document must be unique.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath="s:Footnote"/>
      <xsd:field xpath="@id"/>
    </xsd:unique>

    <xsd:keyref name="DocumentFootnoteReferences"
                refer="s:DocumentFootnoteKey">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          All footnote references must refer to footnotes that exist.
        </xsd:documentation>
      </xsd:annotation>

      <xsd:selector xpath="s:Subsection/*/s:LinkFootnote"/>
      <xsd:field xpath="@target"/>
    </xsd:keyref>
  </xsd:element>

</xsd:schema>
```


<a id="id_b3169e89-019a-41b8-89e5-49b985fd25df"/>

## 7. License

This documentation is placed into the public domain.

<a id="d0e1941"/>

#### 7.2. License

```
Copyright © 2021 Mark Raynsford <code@io7m.com> https://www.io7m.com

This book is placed into the public domain for free use by anyone
for any purpose. It may be freely used, modified, and distributed.

In jurisdictions that do not recognise the public domain this book
may be freely used, modified, and distributed without restriction.

This book comes with absolutely no warranty.
```


## Footnotes

1. <a id="id_7c66cd52-4ace-4fd6-a05d-fd0255e441bb"/>The Dublin Core elements are optional, but some renderers may require them in order to produce sensible output. The title of a [Document](#id_a49dac27-48f0-4504-8e03-8f0b73cd9c46) is specified using the [dc:title](https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#http://purl.org/dc/terms/title) element, for example.

2. <a id="id_9977adf0-b726-46e6-bc98-11176e1d2916"/>The **MetaProperty** elements were added in version **8.0** of the **structural** language.

