Abstract
EPUB® 3 defines a distribution and interchange format for digital publications and documents. The EPUB format provides a means of representing, packaging, and encoding structured and semantically enhanced web content — including HTML, CSS, SVG, and other resources — for distribution in a single-file container.
This specification defines the authoring requirements for EPUB publications and represents the third major revision of the standard.
Status of This Document
This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the W3C standards and drafts index.
This document was published by the Publishing Maintenance Working Group as a Recommendation using the Recommendation track.
W3C recommends the wide deployment of this specification as a standard for the Web.
A W3C Recommendation is a specification that, after extensive consensus-building, is endorsed by W3C and its Members, and has commitments from Working Group members to royalty-free licensing for implementations. Future updates to this Recommendation may incorporate new features.
This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent that the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 18 August 2025 W3C Process Document.
Table of Contents
- Abstract
- Status of This Document
- 1. Introduction
- 2. EPUB publication conformance
- 3. Publication resources
- 4. Open Container Format (OCF)
- 4.1 Introduction
- 4.2 OCF abstract container
- 4.2.1 Introduction
- 4.2.2 File and directory structure
- 4.2.3 File paths and file names
- 4.2.4 Deriving file paths
- 4.2.5 URLs in the OCF abstract container
- 4.2.6
META-INFdirectory- 4.2.6.1 Inclusion in OCF abstract container
- 4.2.6.2 Parsing URLs in the
META-INFdirectory - 4.2.6.3 Reserved files
- 4.3 OCF ZIP container
- 4.4 Font obfuscation
- 5. Package document
- 5.1 Introduction
- 5.2 Parsing URLs in the package document
- 5.3 Shared attributes
- 5.4 The
packageelement - 5.5 Metadata section
- 5.6 Manifest section
- 5.7 Spine section
- 5.8 Collections
- 5.9 Legacy features
- 6. EPUB content documents
- 7. EPUB navigation document
- 8. Layout rendering control
- 9. Media overlays
- 9.1 Introduction
- 9.2 Media overlay documents
- 9.3 Creating media overlays
- 9.4 Skippability and escapability
- 9.5 Navigation document overlays
- 10. Accessibility
- 11. Security and privacy
- A. Unsupported features
- B. Allowed external identifiers
- C. Expressing structural semantics
- D. Vocabularies
- E. Prefixed CSS properties
- F. The
viewport metatag - G. Schemas
- H. Detailed examples
- I. Media type registrations
- J. Index
- K. Change log
- L. Acknowledgements
- M. References
This section is non-normative.
EPUB 3 has been widely adopted as the format for digital books (ebooks), and this revision continues to increase the format's capabilities to better support a wider range of publication requirements, including complex layouts, rich media and interactivity, and global typography features. The expectation is that publishers will utilize the EPUB 3 format for a broad range of content, including books, magazines, and educational, professional, and scientific publications.
This specification represents the core of EPUB 3 and includes the conformance requirements for EPUB publications — the product of the standard. The other specifications that comprise EPUB 3 are as follows:
-
EPUB 3 Reading Systems [epub-rs-33] — defines the processing requirements for EPUB reading systems — the applications that consume EPUB publications and present their content to users.
-
EPUB Accessibility [epub-a11y-11] — defines accessibility conformance and discovery requirements for EPUB publications.
These specifications represent the formal list recognized as belonging to EPUB 3 and that contain functionality normatively referenced as part of the standard. The development of extension specifications periodically adds new functionality to EPUB publications. Features and functionality defined outside of core revisions to the standard, while not formally recognized in this specification, are nonetheless available for EPUB creators and reading system developers to use.
The non-normative EPUB 3 Overview [epub-overview-33] provides a general introduction to EPUB 3. A list of technical changes from the previous version is also available in the change log.
This section is non-normative.
This section reviews the organization of this specification through the central product it defines: the EPUB publication.
An EPUB publication is, in its most basic sense, a bundle of resources with instructions on how to render those resources to present the content in a logical order. The types of resources that are allowed in EPUB publication, as well as restrictions on their use, are defined in 3. Publication resources.
A ZIP-based archive with the file extension .epub bundles the EPUB publication's
resources for distribution. As conformant ZIP archives, EPUB publications can be unzipped by many
software programs, simplifying both their production and consumption.
The container format not only provides a means of determining that the zipped content represents an
EPUB publication (the mimetype file), but also provides a universally named directory
of non-normative resources (/META-INF). Key among these resources is the
container.xml file, which directs reading systems to the available package documents. Refer to 4. Open Container Format (OCF) for more information about the container format.
An EPUB publication is typically represented by a single package document. This document includes metadata used by reading systems to present the content to the user, such as the title and author for display in a bookshelf as well as rendering metadata (e.g., whether the content is reflowable or has a fixed layout). It also provides a manifest of resources and includes a spine that lists the default sequence in which to render documents as a user progresses through the content. Refer to 5. Package document for the requirements for the package document.
The actual content of an EPUB publication — what users are presented with when they begin reading — is built on the Open Web Platform and comes in two flavors: XHTML and SVG. Called EPUB content documents, these documents typically reference many additional resources required for their proper rendering, such as images, audio and video clips, scripts, and style sheets.
Refer to 6. EPUB content documents for detailed information about the rules and requirements to produce EPUB content documents, and [epub-a11y-11] for accessibility requirements.
An EPUB publication also includes another key file called the EPUB navigation document. This document provides critical navigation capabilities, such as the table of contents, that allow users to navigate the content quickly and easily. The navigation document is a specialized type of XHTML content document which also allows EPUB creators to use it in the content (i.e., avoiding one table of contents for machine processing and another for user consumption). Refer to 7. EPUB navigation document for more information about this document.
EPUB publications by default are intended to reflow to fit the available screen space. It is also possible to create publications that have pixel-precise fixed layouts using images and/or CSS positioning. The metadata to control layouts are defined in 8. Layout rendering control.
Media overlay documents complement EPUB content documents. They provide declarative markup for synchronizing the text in EPUB content documents with prerecorded audio. The result is the ability to create a read-aloud experience where reading systems highlight the text as it is narrated. Refer to 9. Media overlays for the definition of media overlay documents.
While conceptually simple, an EPUB publication is more than just a collection of HTML pages and dependent assets in a ZIP package as presented here. Additional information about the primary features and functionality that EPUB publications provide to enhance the reading experience is available from the referenced specifications, and a more general introduction to the features of EPUB 3 is provided in the non-normative [epub-overview-33].
Refer to [epub-rs-33] for the processing requirements for reading systems. Although it is not necessary that EPUB creators read that document to create EPUB publications, an understanding of how reading systems present the content can help craft publications for optimal presentation to users.
This section is non-normative.
Caution
The technologies EPUB 3 builds on are constantly evolving. Some, typically referred to as "living" or "evergreen" standards, are subject to change daily and their impact on the validity of EPUB publications is immediate. Others are updated less frequently and the changes may not affect EPUB publications until EPUB 3 undergoes a new revision.
In all cases, it is possible that previously valid features may become obsolete (e.g., due to a lack of support or because of security issues). EPUB creators should therefore be cautious about using any feature without broad support and keep their EPUB conformance checkers up to date.
The [html] standard is continuously evolving — there are no longer versioned releases of it. That standard, in turn, references various technologies that continue to evolve, such as MathML, SVG, CSS, and JavaScript.
The benefit of this approach for EPUB is that EPUB publications always keep pace with changes to the web without the need for new revisions. EPUB creators, however, must keep track of the various changes to HTML and the technologies it references to ensure they keep their processes up to date.
The XHTML profile defined by this specification inherits all definitions of semantics, structure and processing behaviors from HTML unless otherwise specified.
In addition, this specification defines a set of extensions to the [html] document model that EPUB creators may include in XHTML content documents.
This specification does not reference a specific version of [svg], but instead uses an undated reference. Whenever there is any ambiguity in this reference, the latest recommended specification is the authoritative reference.
This approach ensures that EPUB will always keep pace with changes to the SVG standard. EPUB creators, however, must keep track of changes to the SVG standard to ensure they keep their processes up to date.
EPUB 3 supports CSS as defined by the CSS Working Group Snapshot [csssnapshot]. EPUB 3 also maintains some prefixed CSS properties, to ensure consistent support for global languages.
EPUB 3 only supports Presentation Markup [mathml3]. Content Markup is only allowed in structured markup annotations.
This specification relies on a subset of [smil3], from which the media overlays elements and attributes defined in 9.2.2 Media overlay document definition are derived.
This specification refers to the [url] standard for terminology and processing related to URLs expressed in EPUB publications. It is anticipated that new and revised web formats will adopt this standard, but until then this may put this specification in conflict with the internal requirements for some formats (e.g., valid relative paths), specifically with respect to the use of internationalized URLs. If a format does not allow internationalized URLs (i.e., URLs must conform to [rfc3986] or earlier), that requirement takes precedence within those resources.
This specification defines the following terms specific to EPUB 3.
Note
Only the first instance of a term in a section links to its definition.
- codec
-
Codec refers to content that has intrinsic binary format qualities, such as video and audio media types designed for optimum compression or that provide optimized streaming capabilities.
- container resource
-
A publication resource that is located within the EPUB container, as opposed to a remote resource which is not.
Refer to 3.6 Resource locations for media type-specific rules for resource locations.
- container root URL
-
The URL [url] of the root directory representing the OCF abstract container. It is implementation specific, but EPUB creators must assume it has properties defined in 4.2.5 URLs in the OCF abstract container.
- content URL
-
The URL of a file or directory in the OCF abstract container, defined in 4.2.5 URLs in the OCF abstract container.
- core media type resource
-
A publication resource that conforms to one of the MIME media types [rfc2046] listed in 3.2 Core media types and, therefore, does not require the provision of a fallback (cf. foreign resource).
The designation "core media type resource" only applies when a resource is used in the rendering of EPUB content documents and foreign content documents. A core media type resource cannot be used in the spine, for example, without a fallback unless it also has the media type of an EPUB content document.
- EPUB conformance checker
-
An application that verifies the requirements of this specification against EPUB publications and reports on their conformance.
- EPUB container
- OCF ZIP container
-
The ZIP-based packaging and distribution format for EPUB publications defined in 4.3 OCF ZIP container.
EPUB container and OCF ZIP container are synonymous.
- EPUB content document
-
A publication resource referenced from the spine or a manifest fallback chain that conforms to either the XHTML or SVG content document definitions.
EPUB content documents contain all or part of the content of an EPUB publication (i.e., the textual, visual and/or audio content).
EPUB creators can include EPUB content documents in the spine without the provision of fallbacks.
- EPUB creator
-
An individual, organization, or process that produces an EPUB publication.
Note
The creation of an EPUB publication often involves the work of many individuals, and may be split across multiple organizations (e.g., when a publisher outsources all or part of the work). Depending on the process used to produce an EPUB publication, responsibilities may fall on the organization (e.g., the publisher), the individuals preparing the publication (e.g., technical editors), or automatic procedures (e.g., as part of a publication pipeline). As a result, not every party or process may be responsible for ensuring every requirement is met, but there is always an EPUB creator responsible for the conformance of the final EPUB publication.
Previous versions of this specification referred to the EPUB creator as the Author.
- EPUB manifest (or manifest)
-
The section of the package document that lists the publication resources.
Refer to 5.6.1 The
manifestelement for more information. - EPUB navigation document
-
A specialization of the XHTML content document that contains human- and machine-readable global navigation information. The EPUB navigation document conforms to the constraints expressed in 7. EPUB navigation document.
- EPUB publication
-
A logical document entity consisting of a set of interrelated resources packaged in an EPUB container.
An EPUB publication typically represents a single intellectual or artistic work, but this specification does not restrict the nature of the content.
- EPUB reading system (or reading system)
-
A system that processes EPUB publications for presentation to a user in a manner conformant with this specification.
- EPUB spine (or spine)
-
The section of the package document that defines an ordered list of EPUB content documents and foreign content documents. This list represents the default reading order of the EPUB publication.
Refer to 5.7.1 The
spineelement for more information. - exempt resource
-
Exempt resources are a special class of publication resources that reading systems are not required to support the rendering of, but EPUB creators do not have to provide fallbacks for.
Refer to 3.4 Exempt resources for more information.
- file name
-
The name of any type of file within an OCF abstract container, whether a directory or a file within a directory.
- file path
-
The file path of a file or directory is its full path relative to the root directory, as defined by the algorithm specified in 4.2.4 Deriving file paths.
- fixed-layout document
-
An EPUB content document with fixed dimensions directly referenced from the spine. Fixed-layout documents are designated
pre-paginatedin the package document, as defined in 8.2 Fixed layouts. - foreign content document
-
Any publication resource referenced from a spine
element, or a manifest fallback chain, that is not an EPUB content document.itemrefWhen a foreign content document is referenced from a spine
itemrefelement, it requires a manifest fallback chain with at least one EPUB content document.Note
With the exception of XHTML and SVG, all core media type resources are foreign content documents when referenced directly from the spine.
- foreign resource
-
A publication resource with a MIME media type [rfc2046] that does not match any of those listed in 3.2 Core media types. Foreign resources are subject to the fallback requirements defined in 3.3 Foreign resources.
The designation "foreign resource" only applies to resources used in the rendering of EPUB content documents and foreign content documents.
Note
Foreign resource and foreign content document are not interchangeable terms. The types of resources considered foreign when used in the spine is greater than the types of resources considered foreign when used in EPUB content documents.
- linked resource
-
A resource that is only referenced from a package document
element (i.e., not also used in the rendering of an EPUB publication.linkLinked resources are not publication resources but may be stored in the EPUB container. They do not require fallbacks.
- media overlay document
-
An XML document that associates the XHTML content document with pre-recorded audio narration to provide a synchronized playback experience, as defined in 9. Media overlays.
- non-codec
-
Non-codec refers to content types that benefit from compression due to the nature of their internal data structure, such as file formats based on character strings (for example, HTML, CSS, etc.).
- OCF abstract container
-
The OCF abstract container defines a file system model for the contents of the OCF ZIP container, as defined in 4.2 OCF abstract container.
- package document
-
A publication resource that describes the rendering of an EPUB publication, as defined in 5. Package document. The package document carries meta information about the EPUB publication, provides a manifest of resources, and defines a default reading order.
- publication resource
-
A resource that contains content or instructions that contribute to the logic and rendering of an EPUB publication. In the absence of this resource, reading systems may not render the EPUB publication as the EPUB creator intends. Examples of publication resources include the package document, EPUB content documents, CSS Style Sheets, audio, video, images, embedded fonts, and scripts.
EPUB creators must list publication resources in the package document manifest and typically bundle them all in the EPUB container (the exception being they may locate resources listed in 3.6 Resource locations outside the EPUB container).
- remote resource
-
A publication resource that is located outside of the EPUB container, typically on the web.
Publication resources within the EPUB container are referred to as container resources.
Refer to 3.6 Resource locations for media type specific rules for resource locations.
- root directory
-
The root directory represents the base of the OCF abstract container file system. This directory is virtual in nature.
- scripted content document
-
An EPUB content document that includes scripting or an XHTML content document that contains [html]
formelements.Refer to 6.3.2 Scripting for more information.
- SVG content document
-
An EPUB content document that conforms to the constraints expressed in 6.2 SVG content documents.
- synthetic spread
-
The rendering of two adjacent pages simultaneously on a device screen.
- top-level content document
-
An EPUB content document or foreign content document referenced from the spine, whether directly or via a fallback chain.
- unique identifier
-
The primary identifier for an EPUB publication. The unique identifier is the value of the
element specified by thedc:identifierunique-identifierattribute in the package document.Significant revision, abridgement, etc. of the content requires a new unique identifier.
- viewport
-
The region of an EPUB reading system in which an EPUB publication is rendered visually to a user.
- XHTML content document
-
An EPUB content document that conforms to the profile of [html] defined in 6.1 XHTML content documents.
XHTML content documents use the XML syntax defined in [html].
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, MUST NOT, OPTIONAL, RECOMMENDED, REQUIRED, SHOULD, and SHOULD NOT in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
All algorithm explanations are non-normative.
This section is non-normative.
In package document metadata examples, reserved prefixes are used without declaration.
References to Dublin Core elements [dcterms] use the dc: prefix. This prefix must be
declared in the package document for their use to be valid
(xmlns:dc="http://purl.org/dc/elements/1.1/")
The epub namespace prefix [xml-names] is also used on elements and attributes without
always having an explicit declaration (xmlns:epub="http://www.idpf.org/2007/ops").
An EPUB publication:
-
MUST define at least one rendering of its content as follows:
-
MUST contain a package document that conforms to 5. Package document and meet all publication resource requirements for the package document.
-
MUST contain an EPUB navigation document that conforms to 7. EPUB navigation document.
-
-
SHOULD conform to the accessibility requirements defined in [epub-a11y-11].
-
MUST be packaged in an EPUB container as defined in 4. Open Container Format (OCF).
In addition, all publication resources MUST adhere to the requirements in 3. Publication resources.
The rest of this specification covers specific conformance details.
This section is non-normative.
Due to the complexity of this specification and number of technologies used in EPUB publications, EPUB creators are advised to use an EPUB conformance checker to verify the conformance of their content.
EPUBCheck is the de facto EPUB conformance checker used by the publishing industry and has been updated with each new version of EPUB. It is integrated into a number of authoring tools and also available in alternative interfaces and other languages (for more information, refer to its Apps and Tools page).
When verifying their EPUB publications, EPUB creators should ensure they do not violate the requirements of this specification (practices identified by the keywords "MUST", "MUST NOT", and "REQUIRED"). These types of issues will often result in EPUB publications not rendering or rendering in inconsistent ways. These issues are typically reported as errors or critical errors.
EPUB creators should also ensure that their EPUB publications do not violate the recommendations of this specification (practices identified by the keywords "SHOULD", "SHOULD NOT", and "RECOMMENDED"). Failure to follow these practices does not result in an invalid EPUB publication but may lead to interoperability problems and other issues that impact the user reading experience. These issues are typically reported as warnings.
Note
Vendors, distributors, and other retailers of EPUB publications should consider the importance of recommended practices before basing their acceptance or rejection on a zero-issue outcome from an EPUB conformance checker. There will be legitimate reasons why EPUB creators cannot follow recommended practices in all cases.
This section is non-normative.
An EPUB publication is made up of many different categories of resources, not all of which are mutually exclusive. Some resources are publication resources, some are not. Some publication resources are allowed in the spine by default, while all others require fallbacks. Some resources can be used in rendering EPUB content documents, while others can only be used with fallbacks.
Trying to understand these differences by reading the technical definitions of each category of resource can be complex. To make the categorizations easier to understand, this introduction uses the concept of different planes to explain how resources are grouped and referred to.
The three planes are:
- The manifest plane — The manifest plane holds all the resources of the EPUB publication (namely, publication resources and linked resources).
- The spine plane — The spine plane holds only the resources used in rendering the spine (namely, EPUB content documents and foreign content documents).
- The content plane — The content plane holds only the resources used in the rendering of EPUB and foreign content documents (namely, core media type resources, foreign resources and exempt resources).
The same resource may exist on more than one plane and will be referred to differently in this specification depending on which plane is being discussed. For example, a core media type resource used in the rendering of an EPUB content document (on the content plane) may also be a foreign content document if it is also listed in the spine (the spine plane).
The following sections describe these planes in more detail.
Note
Refer to H.1 Resources for a detailed example showing how resources fit into the different planes.
To manifest plane defines all the resources of an EPUB publication. It is analogous to the package document manifest, but includes resources not present in that list.
The primary resources in this group are designated publication resources, which are all the
resources used in rendering an EPUB publication to the user. EPUB creators always have to
list these resources in the element.manifest
Publication resources are further classified by their use(s) in the spine plane and content plane.
The manifest plane also contains a set of linked resources. These resources are tangential to the direct rendering. They include, for example, metadata records and links to external content (e.g., where to purchase an EPUB publication).
Unlike publication resources, they are not listed in the package document manifest (i.e., because
they are not essential to rendering the EPUB publication). They are instead defined in
elements in the package document metadata. These elements define their nature and purpose
similar to how manifest link elements define publication resource. (In this way, they are
like an extension of the manifest.)item
Refer to 5.5.6 The link element for more information about linked resources.
Resources in the manifest plane are also sometimes broken down by where they are located. Although most publication resources have to be located in the EPUB container (called container resources), EPUB 3 allows audio, video, font and script data resources to be hosted outside the container. These exceptions were made to speed up the download and loading of EPUB publications, as these resources are typically quite large, and, in the case of fonts, not essential to the presentation. When remotely hosted, these publication resources are referred to as remote resources.
Since linked resources are not essential to the rendering of an EPUB publication, there are no requirements on where they are located and consequently no special naming of them based on their location. They may be located within the EPUB container or outside it.
Note
Hyperlinked content outside the EPUB container (e.g., web pages) are not publication resources, and consequently are not listed in the manifest. Reading systems will normally open these links in a separate browser instance, not as part of the EPUB publication.
The spine plane defines resources used in the default reading order established by the spine, which includes both linear and non-linear content. The spine instructs reading systems on how to load these resources as the user progresses through the EPUB publication. Although many resources may be bundled in an EPUB container, they are not all allowed by default in the spine.
EPUB 3 defines a special class of resources called EPUB content documents that EPUB creators can use in the spine without any restrictions. EPUB content documents encompass both XHTML content documents and SVG content documents.
To use any other type of resource in the spine, called a foreign content document, requires including a fallback to an EPUB content document. This extensibility model allows EPUB creators to experiment with formats while ensuring that reading systems are always able to render something for the user to read, as there is no guarantee of support for foreign content documents.
A mechanism called manifest fallbacks allows EPUB creators
to provide fallbacks for foreign content documents. In this model, the manifest entry for the foreign content document must include a fallback attribute that points to the next
possible resource for reading systems to try when they do not support its format. Although not
common, a fallback resource can specify another fallback, thereby making chains many resources
deep. The one requirement is that there must be at least one EPUB content document in a
manifest fallback chain.
Although they are not directly listed in the spine, all of the resources in the fallback chain are considered part of the spine, and by extension part of the spine plane, since any may be used by a reading system.
Refer to 3.5.1 Manifest fallbacks for more information.
Caution
Although manifest fallbacks fulfill the technical requirements of EPUB, there is little practical support for them in reading systems. Their use is strongly discouraged as it can lead to unreadable publications.
Note
It is possible to provide manifest fallbacks for EPUB content documents, but this is not required or common. For example, a scripted content document could have a fallback to an unscripted alternative for reading systems that do not support scripting.
The content plane classifies resources that are used when rendering EPUB content documents and foreign content documents. These types of resources include embedded media, CSS style sheets, scripts, and fonts. These resources fall into three categories based on their reading system support: core media type resources, foreign resources, and exempt resources.
A core media type resource is one that reading systems have to support, so it can be used without restriction in EPUB or foreign content documents. For more information about core media type resources, refer to 3.2 Core media types.
Note
Being a core media type resource does not mean that reading systems will always render the resource, as not all reading systems support all features of EPUB 3. A reading system without a viewport, for example, will not render visual content such as images.
The opposite of core media type resources are foreign resources. These are resources that reading systems are not guaranteed to support the rendering of. As a result, similar to how using foreign content documents in the spine requires fallbacks to ensure their rendering, using foreign resources in content documents also requires fallbacks. These fallbacks are provided in one of two ways: using the capabilities of the host format or via manifest fallbacks.
The preferred method is to use the fallback capabilities of the host format. Many HTML elements,
for example, have intrinsic fallback capabilities. One example is the picture
element [html], which allows EPUB creators to specify multiple alternative image
formats.
If an intrinsic fallback method is not available, it is also possible to use manifest fallbacks, but this method, as cautioned against in the previous section, is discouraged. For more information about foreign resources, refer to 3.3 Foreign resources.
Falling between core media type resources and foreign resources are exempt resources. These are most closely associated with foreign resources, as there is no guarantee that reading systems will render them. But like core media types, they do not require fallbacks.
Exempt resources tend to address specific cases for which there are no core media types defined,
but for which providing a fallback would prove cumbersome or unnecessary. These include
embedding video, adding accessibility tracks, and linking to resources from the [html] link element.
Refer to 3.4 Exempt resources for more information about these exceptions.
Note
A common point of confusion arising from core media type resources is the listing of XHTML and SVG as core media type resources with the requirement the markup conform to their respective EPUB content document definitions. This allows EPUB creators to embed both XHTML and SVG documents in EPUB content documents while keeping consistent requirements for authoring and reading system support.
In practice, it means that EPUB creators can put XHTML and SVG core media type resources in the spine without any modification or fallback (they are also conforming XHTML and SVG content documents), but this is a unique case. All other core media type resources become foreign content documents when used in the spine (i.e., foreign content documents include all foreign resources and all core media type resources except for XHTML and SVG).
EPUB creators MAY include publication resources that conform to the MIME media type [rfc2046] specifications defined in the following table without fallbacks when they are used in EPUB content documents and foreign content documents. These resources are classified as core media type resources.
With the exception of XHTML content documents and SVG content documents, EPUB creators MUST provide manifest fallbacks for core media type resources referenced directly from the spine. In this case, they are foreign content documents.
The columns in the table represent the following information:
-
Media Type—The MIME media type [rfc2046] used to represent the given publication resource in the manifest.
If the table lists more than one media type, the first one is the preferred media type. EPUB creators should use the preferred media type for all new EPUB publications.
- Content Type Definition—The specification to which the given core media type resource must conform.
- Applies to—The publication resource type(s) that the Media Type and Content Type Definition applies to.
| Media Type | Content Type Definition | Applies to |
|---|---|---|
| Images | ||
image/gif
|
[gif] | GIF Images |
image/jpeg
|
[jpeg] | JPEG Images |
image/png
|
[png] | PNG Images |
image/svg+xml
|
SVG content documents | SVG documents |
image/webp
|
[rfc9649] | WebP Images |
| Audio | ||
audio/mpeg
|
[mp3] | MP3 audio |
audio/mp4
|
[mpeg4-audio], [mp4] | AAC LC audio using MP4 container |
audio/ogg; codecs=opus
|
[rfc7845] | OPUS audio using OGG container |
| Style | ||
text/css
|
CSS Style Sheets | CSS Style Sheets. |
| Fonts | ||
|
[truetype] | TrueType fonts |
|
[opentype] | OpenType fonts |
|
[woff] | WOFF fonts |
font/woff2
|
[woff2] | WOFF2 fonts |
| Other | ||
application/xhtml+xml
|
XHTML content documents | HTML documents that use the XML syntax [html]. |
|
[rfc4329] | Scripts. |
application/x-dtbncx+xml
|
[opf-201] | The legacy NCX. |
application/smil+xml
|
Media overlays | EPUB media overlay documents |
Note
Inclusion as a core media type resource does not mean that all reading systems will support the rendering of a resource. Reading system support also depends on the capabilities of the application (e.g., a reading system with a viewport must support image core media type resources, but a reading system without a viewport does not). Refer to Core media types [epub-rs-33] for more information about which reading systems rendering capabilities require support for which core media type resources.
The Working Group typically only includes formats as core media type resources when they have broad support in web browser cores — the rendering engines that EPUB 3 reading systems build upon. They are an agreement between reading system developers and EPUB creators to ensure the predictability of rendering of EPUB publications.
A foreign resource, unlike a core media type resource is one which is not guaranteed reading system support when used in an EPUB content document or foreign content document.
EPUB creators MUST provide fallbacks for foreign resources, where fallbacks take one of the following forms:
-
intrinsic fallback mechanisms provided by the host format (e.g., [html] elements often provide the ability to reference more than one media type or to display an alternate embedded message when a media type cannot be rendered); or
-
manifest fallback chains defined on
elements in the package document.item
Note
Refer to the [html] and [svg] specifications for the intrinsic fallback capabilities their elements provide.
3.5.2 Intrinsic fallbacks also provides additional information about how fallbacks are interpreted for specific elements.
An exempt resource shares properties with both foreign resources and core media type resources. It is most similar to a foreign resource in that it is not guaranteed reading system support, but, like a core media type resource, does not require a fallback.
There are only a small set of special cases for exempt resources. Video, for example, are exempt from fallbacks because there is no consensus on a core media type video format at this time (i.e., there is no format to fallback to). Similarly, audio and video tracks are exempt to allow EPUB creators to meet accessibility requirements using whatever format reading systems support best.
The following list details cases of content-specific exempt resources, including any restrictions on where EPUB creators can use them.
- Fonts
-
All font resources not already covered as font core media types are exempt resources.
This exemption allows EPUB creators to use any font format without a fallback, regardless of reading system support expectations, as CSS rules will ensure a fallback font in case of no support.
Refer to the reading system support requirements for fonts [epub-rs-33] for more information.
- Linked resources
-
Any resource referenced from the [html]
linkelement that is not already a core media type resource (e.g., CSS style sheets) is an exempt resource. - Tracks
-
All audio and video tracks (e.g., [webvtt] captions, subtitles and descriptions) referenced from the [html]
trackelement are exempt resources. - Video
-
All video codecs referenced from the [html]
video— including any childsourceelements — are exempt resources.Note
Although reading systems are encouraged to support at least one of the H.264 [h264] and VP8 [rfc6386] video codecs, support for video codecs is not a conformance requirement. EPUB creators must consider factors such as breadth of adoption, playback quality, and technology royalties when deciding which video formats to include.
Note
The exemptions made above do not apply to the spine. If an exempt resource is used in the spine, and it is not also an EPUB content document, it will require a fallback in that context.
In addition to the content-specific exemptions, a resource is classified as an exempt resource if:
-
it is not referenced from a spine
element (i.e., used as a foreign content document); anditemref -
it is not embedded directly in EPUB content documents (e.g., via [html] embedded content and [svg]
imageandforeignObjectelements).
This exemption allows EPUB creators to include resources in the EPUB container that are not for use by EPUB reading systems. The primary case for this exemption is to allow data files to travel with an EPUB publication, whether for scripts to use in their constituent EPUB content documents or for external applications to use (e.g., a scientific journal might include a data set with instructions on how to extract it from the EPUB container).
It also allows EPUB creators to use foreign resources in foreign content documents without reading systems or EPUB conformance checkers having to understand the fallback capabilities of those resources (i.e., the requirement for a fallback for the foreign content document covers any rendering issues within it). As the resource is not referenced from an EPUB content document, it automatically becomes exempt from fallbacks.
Manifest fallbacks are a feature of the package document that create a manifest fallback chain for a publication resource, allowing reading systems to select an alternative format they can render.
Fallback chains are created using the fallback
attribute on manifest elements. This attribute references
the ID [xml] of another manifest itemitem that is a
fallback for the current item. The ordered list of all the references that a
reading system can reach, starting from a given item's fallback
attribute, represents the full fallback chain for that item. This chain also
represents the EPUB creator's preferred fallback order.
There are two cases for manifest fallbacks:
- Spine fallbacks
-
EPUB creators MUST specify a fallback chain for a foreign content document to ensure that reading systems can always render the spine item. In this case, the chain MUST contain at least one EPUB content document.
EPUB creators MAY provide fallbacks for EPUB content documents (e.g., to provide a fallback for scripted content).
When a fallback chain includes more than one EPUB content document, EPUB creators can use the
propertiesattribute to differentiate the purpose of each. - Content fallbacks
-
Note
The original purpose for content fallbacks was to specify fallback images for the [html]
imgelement. As HTML now has intrinsic fallback mechanism for images, the use of content fallbacks is strongly discouraged. EPUB creators should always use the intrinsic fallback capabilities of [html] and [svg] to provide fallback content.EPUB creators MUST provide a content fallback for foreign resources when the elements that reference them do not have intrinsic fallback capabilities. In this case, the fallback chain MUST contain at least one core media type resource.
EPUB creators MAY also provide manifest fallbacks for core media type resources (e.g., to allow reading systems to select from more than one image format).
Regardless of the type of manifest fallback specified, fallback chains MUST NOT contain
self-references or circular references to item elements in the chain.
Note
As it is not possible to use manifest fallbacks for resources represented in data URLs, EPUB creators can only represent foreign resources as data URLs where an intrinsic fallback mechanism is available.
The following sections provide additional clarifications about the intrinsic fallback requirements of specific elements.
EPUB creators MUST NOT use embedded
[html] flow content within a media element
(i.e, audio or video) as an intrinsic fallback for
audio foreign resources. Only child source elements [html] provide intrinsic
fallback capabilities.
Only older reading systems that do not recognize the audio or the
video elements (e.g., EPUB 2 reading systems) will render the embedded
content. When reading systems support these elements but not the available media formats,
they do not render the embedded content for the user.
Note
The requirement for fallbacks only applies to audio foreign resources referenced from
audio and video elements. Fallbacks are not required for
video resources; they are exempt resources.
Due to the variety of sources that EPUB creators
can specify in the [html] img element, the following fallback conditions apply to its
use:
-
If it is the child of a
pictureelement:- it MUST reference core media type resources from its
srcandsrcsetattributes, when EPUB creators specify those attributes; and - each sibling
sourceelement MUST reference a core media type resource from itsandsrcattributes unless it specifies the MIME media type [rfc2046] of a foreign resource in itssrcsetattribute.type
- it MUST reference core media type resources from its
- Otherwise, it MAY reference foreign resources in its
andsrcattributes provided EPUB creators define a manifest fallback.srcset
Although data blocks have a separate MIME media type [rfc2046] from their containing
XHTML content document, it is not possible to provide intrinsic fallbacks as no such
mechanisms are specified for the [html] script element. It is also not possible to
provide manifest fallbacks because data blocks cannot be defined as standalone files in the
EPUB container but are always embedded as inline script elements.
But, as the script element does not represent user content — data blocks are not rendered unless manipulated by
script, and content rendered by scripts already has core
media type requirements — requiring fallbacks for the raw data does not serve a
useful purpose.
Consequently, to ensure that EPUB creators can include data blocks for scripting purposes, they are exempt from fallback requirements.
Note
This exemption aligns data blocks with the exemption for data files.
Note
[svg] does not define data blocks as of publication, but the same exclusion would apply if a future update adds the concept.
EPUB creators MAY host the following types of publication resources outside the EPUB container:
EPUB creators MUST store all other resources within the EPUB container.
Storing all resources inside the EPUB container is strongly encouraged whenever possible as it allows users access to the entire presentation regardless of connectivity status.
When resources have to be located outside the EPUB container, EPUB creators are RECOMMENDED to
reference them via the secure https URI scheme [rfc9110] to limit the threat of
exposing their publications, and users, to network attacks. Reading systems might not load
remote resources referenced using insecure schemes such as http.
These rules for locating publication resource apply regardless of whether the given resource is a core media type resource or a foreign resource.
Note
Refer to the remote-resources property for more
information on how to indicate that a manifest references a
remote resource.item
The data: URL scheme [rfc2397] is used to encode resources
directly into a URL string. The advantage of this scheme is that it allows EPUB creators to
embed a resource within another, avoiding the need for an external file.
EPUB creators MUST NOT use data URLs in the following scenarios where they can result in a top-level content document or top-level browsing context [html]:
-
in
hrefattributes in the package document — this applies both to manifestelements and metadataitemelements;link -
in the
hrefattribute on [html] or [svg]aelements, except when inside aniframeelement [html]; -
in the
hrefattribute on [html]areaelements, except when inside aniframeelement; -
in calls to [ecmascript]
window.openordocument.open.
Note
These restrictions on the use of data URLs are to prevent security issues and also to ensure that reading systems can determine where to take a user next (i.e., because data URLs cannot be referenced from the spine).
The list of prohibited uses for data URLs is subject to change as the respective standards that allow their use evolve.
A consequence of embedding is that the data in a data URL is not considered its own unique publication resource for manifest reporting purposes (i.e., only its containing publication resource gets listed). As this data has its own media type, however, it is still subject to foreign resource restrictions. EPUB creators MUST therefore encode data URLs as core media type resources or provide a fallback using the intrinsic fallback mechanisms of the host format.
The file: URL scheme is defined in [rfc8089] as
"identifying an object (a 'file') stored in a structured object naming and accessing environment on
a host (a 'file system')." It is typically used to retrieve files from the local operating
system.
Using a file URL in an EPUB publication, which can be transferred among different hosts, represents a security risk and is also non-interoperable. As a consequence, EPUB creators MUST NOT use file URLs in EPUB publications.
Any publication resource that is an XML-based media type [rfc2046]:
-
MUST be a conformant XML 1.0 Document as defined in Conformance of Documents [xml-names].
-
MAY only specify a document type declaration that references an external identifier appropriate for its media type — as defined in B. Allowed external identifiers — or that omits external identifiers [xml].
-
MUST NOT contain external entity declarations in the internal DTD subset [xml].
-
MUST NOT make use of XInclude [xinclude].
-
MUST be encoded in UTF-8 or UTF-16 [unicode], with UTF-8 as the RECOMMENDED encoding.
The above constraints apply regardless of whether the given publication resource is a core media type resource or a foreign resource.
This section is non-normative.
OCF is the required container technology for EPUB publications. OCF may play a role in the following workflows:
- During the preparation steps in producing an EPUB publication, OCF may be used as the container format when exchanging in-progress publications between different individuals and/or different organizations.
- When providing an EPUB publication from publisher or conversion house to the distribution or sales channel, OCF is the recommended container format to be used as the transport format.
- When delivering the final EPUB publication to an EPUB reading system or user, OCF is the required format for the container that holds all of the assets that make up the publication.
This section defines the rules for structuring the file collection in the abstract: the "abstract container". It also defines the rules for the representation of this abstract container within a ZIP archive: the "physical container". The rules for ZIP physical containers build upon the ZIP technologies used by [odf].
OCF also defines a standard method for obfuscating embedded fonts for those EPUB publications that require this functionality.
This section is non-normative.
The OCF abstract container file system model uses a single common root directory. All container resources are located within the directory tree headed by the root directory, but no specific file system structure for them is mandated by this specification.
The file system model also includes a mandatory directory named META-INF that is a
direct child of the root directory and stores the following special files:
-
container.xml[required] -
Identifies one or more package documents that define the EPUB publication.
-
signatures.xml[optional] -
Contains digital signatures for various assets.
-
encryption.xml[optional] -
Contains information about the encryption of publication resources. This file is mandatory when EPUB creators use font obfuscation.
-
metadata.xml[optional] -
Used to store metadata about the OCF ZIP container.
-
rights.xml[optional] -
Used to store information about digital rights.
-
manifest.xml[optional] -
A manifest of container contents as allowed by Open Document Format [odf].
Refer to 4.2.6 META-INF directory for conformance requirements for the various files
in the META-INF directory.
The virtual file system for the OCF abstract container MUST have a single common root directory for all the contents of the container.
The OCF abstract container MUST include a directory for configuration files named
META-INF that is a direct child of the container's root directory. Refer to 4.2.6 META-INF directory for the requirements for the contents of this
directory.
The file name mimetype in the root directory is reserved for use by OCF ZIP containers, as explained in 4.3 OCF ZIP container.
Files in the META-INF directory and the mimetype file are not
publication resources so MUST NOT be listed in the manifest.
EPUB creators MAY locate all other files within the OCF abstract container in any location
descendant from the root directory, provided they are not within the META-INF
directory. EPUB creators MUST NOT reference files in the META-INF directory from an
EPUB publication.
Note
Some reading systems do not provide access to resources outside the directory where the package document is stored. EPUB creators should therefore place all resources at or below the directory containing the package document to avoid interoperability issues.
This problem is more commonly encountered when creating multiple renditions [epub-multi-rend-11] of the publication.
In the context of the OCF abstract container, file paths and file names are scalar value strings [infra] (i.e., their values are case sensitive).
In addition, the following restrictions are designed to allow file paths and file names to be used without modification on most operating systems:
-
File names MUST NOT exceed 255 bytes.
-
The file paths for any directory or file within the OCF abstract container MUST NOT exceed 65535 bytes.
-
File names MUST NOT use the following [unicode] characters, as commonly used operating systems may not support these characters consistently:
-
SOLIDUS:
/(U+002F) -
QUOTATION MARK:
"(U+0022) -
ASTERISK:
*(U+002A) -
FULL STOP as the last character:
.(U+002E) -
COLON:
:(U+003A) -
LESS-THAN SIGN:
<(U+003C) -
GREATER-THAN SIGN:
>(U+003E) -
QUESTION MARK:
?(U+003F) -
REVERSE SOLIDUS:
\(U+005C) -
VERTICAL LINE:
|(U+007C) -
DEL (
U+007F) -
C0 range (
U+0000 … U+001F) -
C1 range (
U+0080 … U+009F) -
Private Use Area (
U+E000 … U+F8FF) -
All Unicode Non Characters, specifically:
-
The 32 contiguous characters in the Basic Multilingual Plane (
U+FDD0 … U+FDEF) -
The last two code points of the Basic Multilingual Plane (
U+FFFEandU+FFFF) -
The last two code points at the end of the Supplementary Planes (
U+1FFFE, U+1FFFF … U+EFFFE, U+EFFFF)
-
-
Specials (
U+FFF0 … U+FFFF) -
Supplementary Private Use Area-A (
U+F0000 … U+FFFFF) -
Supplementary Private Use Area-B (
U+100000 … U+10FFFF)
Note
The Unicode Character Database [uax44] also includes a list of deprecated characters. EPUB creators are advised to avoid these characters, as well, as it is expected that EPUB conformance checkers will flag their use.
-
-
For compatibility with older reading systems, file names SHOULD NOT contain SPACE (U+0020) characters.
-
All file names within the same directory MUST be unique following Unicode canonical normalization [uax15] and then full case folding [unicode]. (Refer to Unicode Canonical Case Fold Normalization Step [charmod-norm] for more information.)
Note
If EPUB creators dynamically integrate resources (i.e., where the naming is beyond their control), they should be aware that automatic truncation of file names to keep them within the 255 bytes limit can lead to corruption. This is due to the difference between bytes and characters in multibyte encodings such as UTF-8; it is, therefore, important to avoid mid-character truncation. See the section on "Truncating or limiting the length of strings" in [international-specs] for more information.
Note
EPUB creators should use an abundance of caution in their file naming when interoperability of content is key. The list of restricted characters is intended to help avoid some known problem areas, but it does not ensure that all other Unicode characters are supported. Although Unicode support is much better now than in earlier iterations of EPUB, older tools and toolchains may still be encountered (e.g., ZIP tools that only support [us-ascii]).
To derive the file path, given a file or directory file in the OCF abstract container, apply the following steps (expressed using the terminology of [infra]):
- Let path be an empty list.
- Let current be file.
- While current is not the root directory:
- Return the concatenation of path
using the
U+002F (/)character.
The container root URL is the URL [url] of the root directory. It is implementation-specific, but EPUB creators MUST assume it has the following properties:
- The result of parsing "
/" with the container root URL as base is the container root URL. - The result of parsing "
.." with the container root URL as base is the container root URL.
The content URL of a file or directory in the OCF abstract container is the result of parsing the file's file path with the container root URL as base.
Note
The container root URL is the URL assigned by the reading system to the root of the EPUB container. It typically depends on how the reading system internally implements the container file system.
However, a reading system cannot arbitrarily use any URL, but one that honors the constraints defined above. These constraints ensure that any relative URL string found in the EPUB will always be parsed to a URL of a resource within the container (which may or may not exist). The primary reason for these constraints is to avoid potential run-time security issues that would be caused by parsed URLs "leaking" outside the container files.
For example, URLs like https://localhost:12345/ or
https://www.example.org:12345/ honor these properties. But URLs like
https://localhost:12345/path/to.epub/,
file:///path/to.epub#path=/, or jar:file:/path/to.epub!/EPUB/
do not (parsing the URL string ".." with these three examples as base would
return https://localhost:12345/path/, file:///path/, and a parsing
error, respectively). It is the responsibility of the reading system to assign a URL to the
root directory that complies with the properties defined above.
Note
Parsing may replace some characters in the file path by their percent encoded alternative. For example,
A/B/C/file name.xhtml becomes A/B/C/file%20name.xhtml.
A string url is a valid-relative-ocf-URL-with-fragment string if it is a
path-relative-scheme-less-url string, optionally followed by U+0023 (#)
and a url-fragment string, and if the following steps return true:
-
Set the container root URL to
Explanationhttps://a.example.org/A/.The goal of the algorithm is to detect whether url could be seen as "leaking" outside the container. To do that, the standard URL parsing algorithm is used with an artificial root URL; the detection of the "leak" is done by comparing the result of the parsing with the presence of the first test path segment (
A). (Note that the artificial container root URL wilfully violates, for the purpose of this algorithm, the required properties by using that first test path segment.) -
Let base be the base URL that must be used to parse url as defined by the context (document or environment) where url is used, and according to the content URL of the package document (see 5.2 Parsing URLs in the package document).
ExplanationIn the case of a URL in the package document the base variable is set to the content URL of the package document. In the case of a document within the
META-INFdirectory, the base variable is set to the container root URL (see 4.2.6.2 Parsing URLs in theMETA-INFdirectory). In the case of a URL in an XHTML content document, the base URL used for parsing is defined by the HTML standard. Typically, it will be the content URL of the content document (unless the discouragedbaseelement is used). - Let testURLRecord be the result of applying the URL parser to url, with base.
- Let testURLStringA be the result of applying the URL Serializer to testURLRecord.
-
Set the container root URL to
Explanationhttps://b.example.org/B/.The reasons to repeat the same steps twice with different, and artificial, settings of the container root URL is to avoid collision which may occur if the url string also includes
/A/. Consider, for example, the case where url is../../A/doc.xhtml. - Set base to be the base URL that must be used to parse url as defined by the context (document or environment) where url is used, and according to the content URL of the package document (see 5.2 Parsing URLs in the package document).
- Set testURLRecord to be the result of applying the URL parser to url, with base.
- Let testURLStringB be the result of applying the URL Serializer to testURLRecord.
-
If testURLStringA does not start with
Explanationhttps://a.example.org/or testURLStringB does not start withhttps://b.example.org/, return true.If any of the result does not share the test URL host, it means that url, or its base URL (for example, in HTML, if it is explicitly set with the
baseelement), was absolute and points outside the container. This is acceptable. -
If testURLStringA starts with
Explanationhttps://a.example.org/A/and testURLStringB starts withhttps://b.example.org/B/, return true.The presence of the first test path segments (
A, respectivelyB) indicate that the URL doesn't leak outside the container. - Return false.
In the OCF abstract container, any URL string MUST be an absolute-url-with-fragment string or a valid-relative-ocf-URL-with-fragment string.
In addition, all relative-URL-with-fragment strings [url] MUST, after parsing, be equal to the content URL of an existing file in the OCF abstract container.
Note
These constraints on URL strings mean that:
- relative URL strings starting with a
/(U+002F) (for example,/EPUB/content.xhtml) are disallowed; - relative URL strings containing more double-dot URL path segments than needed to
reach the target file (for example,
EPUB/../../../../config.xml) are disallowed; - any other absolute or relative URL string is allowed.
Note that in any case, even the disallowed URL strings described above will not "leak" outside the container after parsing (as explained in the first note of this section). They are nevertheless disallowed for better interoperability with non-conforming or legacy reading systems and toolchains.
All OCF abstract containers MUST include a directory called META-INF in
their root directory.
This directory is reserved for configuration files, specifically those defined in 4.2.6.3 Reserved files.
To parse a URL string
url used in files located in the META-INF directory the URL parser MUST be applied to url, with the
container root URL as base.
The REQUIRED container.xml file in the META-INF directory
identifies the package documents available in the OCF abstract container.
All [xml] elements defined in this section are in the
urn:oasis:names:tc:opendocument:xmlns:container namespace [xml-names]
unless specified otherwise.
The contents of this file MUST be valid to the definition in this section after removing all elements and attributes from other namespaces (including all attributes and contents of such elements).
Note
An XML Schema also informally defines the content of this file.
The container element encapsulates all the information in the
container.xml file.
- Element Name:
-
container - Usage:
-
REQUIRED root element [xml] of the
container.xmlfile. - Attributes:
-
-
version[required] - This attribute MUST have the value
"
1.0".
-
- Content Model:
-
In this order:
The rootfiles element contains a list of package documents available
in the EPUB container.
Each rootfile element identifies the location of one package document in the EPUB container.
- Element Name:
-
rootfile - Usage:
-
As child of the
element. Repeatable.rootfiles - Attributes:
-
-
full-path[required] -
Identifies the location of a package document.
The value of the attribute MUST be a path-relative-scheme-less-URL string [url]. The path is relative to the root directory.
-
media-type[required] -
Identifies the media type of the package document.
The value of the attribute MUST be "
application/oebps-package+xml".
-
- Content Model:
-
Empty
If an EPUB creator defines more than one rootfile element, each MUST
reference a package document that conforms to the same version of EPUB. Each package
document represents one rendering of the EPUB publication.
Note
Although the EPUB container provides the ability to reference more than one package document, this specification does not define how to interpret, or select from, the available options. Refer to [epub-multi-rend-11] for more information on how to bundle more than one rendering of the content.
The links element identifies resources
necessary for the processing of the OCF ZIP container.
- Element Name:
-
links - Usage:
-
OPTIONAL second child of
. Repeatable.container - Attributes:
-
None
- Content Model:
-
link[1 or more]
Note
This specification currently does not define uses for the links
element. Refer to [epub-multi-rend-11] for an example of its use.
- Element Name:
-
link - Usage:
-
As child of the
element. Repeatable.links - Attributes:
-
-
href[required] -
Identifies the location of a resource.
The value of the
linkelementhrefattribute MUST be a path-relative-scheme-less-URL string [url]. The path is relative to the root directory. -
media-type[optional] -
Identifies the type and format of the referenced resource.
The value of the attribute MUST be a media type [rfc2046].
-
rel[required] -
Identifies the relationship of the resource.
The value of the attribute MUST be a space-separated list of tokens.
-
- Content Model:
-
Empty
This section is non-normative.
The OPTIONAL encryption.xml file in the META-INF directory
holds all encryption information on the contents of the container. If an EPUB creator encrypts any resources within the container, they MUST include an
encryption.xml file to provide information about the encryption
used.
- Element Name:
-
encryption - Namespace:
-
urn:oasis:names:tc:opendocument:xmlns:container - Usage:
-
REQUIRED root element [xml] of the
encryption.xmlfile. - Attributes:
-
None
- Content Model:
-
In any order:
EncryptedKey[1 or more]EncryptedData[1 or more]
The encryption element contains child elements of type
EncryptedKey and EncryptedData as defined by
[xmlenc-core1].
An EncryptedKey element describes each encryption key used
in the container, while an EncryptedData element describes each
encrypted file. Each EncryptedData element refers to an
EncryptedKey element, as described in XML Encryption.
Note
An XML Schema also informally
defines the content of the encryption.xml file.
OCF encrypts individual files independently, trading off some security for improved performance, allowing the container contents to be incrementally decrypted. Encryption in this way exposes the directory structure and file naming of the whole package.
OCF uses XML Encryption [xmlenc-core1] to provide a framework for encryption,
allowing a variety of algorithms to be used. XML Encryption specifies a process for
encrypting arbitrary data and representing the result in XML. Even though an OCF abstract container may contain non-XML data, EPUB creators can use XML
Encryption to encrypt all data in an OCF abstract container. OCF encryption
supports only the encryption of entire files within the container, not parts of
files. EPUB creators MUST NOT encrypt the encryption.xml file when
present.
Encrypted data replaces unencrypted data in an OCF abstract container. For example,
if an EPUB creator encrypts an image named photo.jpeg, they should
replace the contents of the photo.jpeg resource with its encrypted
contents. Within the ZIP directory, EPUB creators SHOULD store encrypted files
rather than Deflate-compress them.
Note that some situations require obfuscating the storage
of embedded fonts referenced by an EPUB publication to make them more difficult
to extract for unrestricted use. Although obfuscation is not encryption, reading
systems use the encryption.xml file in conjunction with the font obfuscation algorithm to identify fonts to
deobfuscate.
EPUB creators MUST NOT encrypt the following files:
-
mimetype -
META-INF/container.xml -
META-INF/encryption.xml -
META-INF/manifest.xml -
META-INF/metadata.xml -
META-INF/rights.xml -
META-INF/signatures.xml - [=
package document=]
EPUB creators MAY subsequently encrypt signed resources using the Decryption Transform for XML Signature [xmlenc-decrypt]. This feature enables a reading system to distinguish data encrypted before signing from data encrypted after signing.
When stored in an OCF ZIP container, EPUB creators SHOULD compress streams of data with non-codec content types before encrypting them. EPUB creators MUST use Deflate compression. This practice ensures that file entries stored in the ZIP container have a smaller size.
EPUB creators SHOULD NOT compress streams of data with codec content types before encrypting them. In such cases, additional compression introduces unnecessary processing overhead at production time (especially with large resource files) and impacts audio/video playback performance at consumption time. In some cases, the combination of compression with some encryption schemes might even compromise the ability of reading systems to handle partial content requests (e.g. HTTP byte ranges), due to the technical impossibility to determine the length of the full resource ahead of media playback (e.g. HTTP Content-Length header).
When EPUB creators compress streams of data before encrypting, they SHOULD provide
additional EncryptionProperties metadata to specify the size of the
initial resource (i.e., before compression and encryption), as per the
Compression XML element defined below. When EPUB creators do not
compress streams of data before encrypting, they MAY provide the additional
EncryptionProperties metadata to specify the size of the initial
resource (i.e., before encryption).
- Element Name:
-
Compression - Namespace:
-
http://www.idpf.org/2016/encryption#compression - Usage:
-
OPTIONAL child of
EncryptionProperty. - Attributes:
-
- Method
[required] -
Identifies the compression method used.
Value is either "
0" (no compression) or "8" (Deflate algorithm). - OriginalLength
[required] -
Represents the size of the initial resource (number of bytes).
Value is a positive integer.
- Method
- Content Model:
-
Empty
The OPTIONAL manifest.xml file in the META-INF directory
provides a manifest of files in the container.
The OCF specification does not mandate a format for the manifest.
Note that package documents specify the only manifests used for processing EPUB publications. Reading systems do not use this file.
Note
This feature exists only for compatibility with [odf].
The OPTIONAL metadata.xml file in the META-INF directory is
only for container-level metadata.
If EPUB creators include a metadata.xml file, they SHOULD use only
namespace-qualified elements [xml-names] in it. The file SHOULD contain the root element [xml] metadata in the
namespace http://www.idpf.org/2013/metadata, but this specification allows
other root elements for backwards compatibility.
This version of the specification does not define metadata for use in the
metadata.xml file. Future versions of this specification MAY define
container-level metadata.
This specification reserves the OPTIONAL rights.xml file in the
META-INF directory for the trusted exchange of EPUB publications
among rights holders, intermediaries, and users.
When EPUB creators do not include a rights.xml file, no part of the
OCF abstract container is rights governed at the container level. Rights expressions
might exist within the EPUB publications.
Note
Adding a digital signature is not a guarantee that a malicious actor cannot tamper with an EPUB publication as reading systems do not have to check signatures.
The OPTIONAL signatures.xml file in the META-INF directory
holds digital signatures for the container and its contents.
- Element Name:
-
signatures - Namespace:
-
urn:oasis:names:tc:opendocument:xmlns:container - Usage:
-
REQUIRED root element [xml] of the
signature.xmlfile. - Attributes:
-
None
- Content Model:
-
Signature[1 or more]
The signature element contains child elements of type
Signature, as defined by [xmldsig-core1]. EPUB creators can
apply signatures to an EPUB publication as a whole or to its parts, and can specify
the signing of any kind of data (i.e., not just XML).
Note
An XML Schema also informally
defines the content of the signatures.xml file.
When an EPUB creator does not include a signatures.xml file, they are
not signing any part of the OCF abstract container at the container level.
Digital signing might exist within the EPUB publication.
When an EPUB creator creates a data signature for the OCF abstract
container, they SHOULD add the signature as the last child Signature
element of the signatures element.
Note
Each Signature in the signatures.xml file identifies by
URL [url] the data to which the signature applies, using the [xmldsig-core1]
Manifest element and its Reference sub-elements.
EPUB creator may sign individual container files separately or together.
Separately signing each file creates a digest value for the resource that
reading systems can validate independently. This approach might make a Signature
element larger. If EPUB creators sign files together, they can list the set of
signed files in a single XML Signature Manifest element and
reference them by one or more Signature elements.
EPUB creators can sign any or all files in the OCF abstract
container in their entirety, except for the signatures.xml file since
that file will contain the computed signature information. Whether and how EPUB
creators sign the signatures.xml file depends on their objective.
If the EPUB creator wants to allow signatures to be added or removed from the OCF
abstract container without invalidating their signature, they SHOULD NOT sign the
signatures.xml file.
If the EPUB creator wants any addition or removal of a signature to invalidate their
signature, they can use the Enveloped Signature transform defined in Section 6.6.4 of
[xmldsig-core1] to sign the entire pre-existing signature file excluding the
Signature being created. This transform would sign all previous
signatures, and it would become invalid if a subsequent signature were added to the
package.
Note
If the EPUB creator wants the removal of an existing signature to invalidate their signature, but also wants to allow the addition of signatures, they could use an XPath transform to sign just the existing signatures. The details of such a transform are outside the scope of this specification, however.
The [xmldsig-core1] specification does not associate any semantics with a
signature; an agent might include semantic information, for example, by adding
information to the Signature element that describes the signature. The
[xmldsig-core1] specification describes how additional information can be added to
a signature, such as by use the SignatureProperties element.
This section is non-normative.
An OCF ZIP container is a physical single-file manifestation of an OCF abstract container. The container allows:
-
the exchange of in-progress EPUB publication between different individuals and/or different organizations;
-
the transfer of EPUB publications from a publisher or conversion house to the distribution or sales channel; and
-
the delivery of EPUB publications to EPUB reading systems or users.
An OCF ZIP container uses the ZIP format as specified by [zip], but with the following constraints and clarifications:
-
The contents of the OCF ZIP container MUST be a conforming OCF abstract container.
-
OCF ZIP containers MUST NOT use the features in the ZIP application note [zip] that allow ZIP files to be spanned across multiple storage media or be split into multiple files.
-
OCF ZIP containers MUST include only stored (uncompressed) and Deflate-compressed ZIP entries within the ZIP archive.
-
OCF ZIP containers MAY use the ZIP64 extensions defined as "Version 1" in section V, subsection G of the application note [zip] and SHOULD use only those extensions when the content requires them.
-
OCF ZIP containers MUST NOT use the encryption features defined by the ZIP format; instead, encryption MUST be done using the features described in 4.2.6.3.2 Encryption file (
encryption.xml). -
OCF ZIP containers MUST encode file system names using UTF-8 [unicode].
The following constraints apply to specific fields in the OCF ZIP container archive:
-
In the local file header table, EPUB creators MUST set the
version needed to extractfields to the values10,20or45to match the maximum version level needed by the given file (e.g.,20for Deflate,45for ZIP64). -
In the local file header table, EPUB creators MUST set the
compressionmethod field to the values0or8.
EPUB creators MUST include the mimetype file as the first file in the OCF ZIP container. In addition:
- The contents of the
mimetypefile MUST be the MIME media type [rfc2046] stringapplication/epub+zipencoded in US-ASCII [us-ascii]. - The
mimetypefile MUST NOT contain any leading or trailing padding or whitespace. - The
mimetypefile MUST NOT begin with the Unicode byte order mark U+FEFF. - EPUB creators MUST NOT compress or encrypt the
mimetypefile. - EPUB creators MUST NOT include an extra field in its ZIP header.
Note
Refer to I.2 The application/epub+zip media type for further information about the
application/epub+zip media type.
Caution
Better methods of protecting fonts exist. Both [woff] and [woff2] fonts, for example, allow the embedding of licensing information and provide some protection through font table compression. The use of remotely hosted fonts also allows for font subsetting. EPUB creators are advised to use font obfuscation as defined in this section only when no other options are available to them. See also the limitations of obfuscation.
This section is non-normative.
Since an OCF ZIP container is fundamentally a ZIP file, commonly available ZIP tools can be used to extract any unencrypted content stream from the package. Moreover, the nature of ZIP files means that their contents might appear like any other native container on some systems (e.g., a folder).
While this simplicity of ZIP files is quite useful, it also poses a problem when ease of extraction of fonts is not a desired side-effect of not encrypting them. An EPUB creator who wishes to include a third-party font, for example, typically does not want that font extracted and re-used by others. More critically, many commercial fonts allow embedding, but embedding a font implies making it an integral part of the EPUB publication, not just providing the original font file along with the content.
Since integrated ZIP support is so ubiquitous in modern operating systems, simply placing a font in the OCF ZIP container is insufficient to signify that the font cannot be reused in other contexts. This uncertainty can undermine the otherwise useful font embedding capability of EPUB publications.
To discourage reuse of their fonts, some font vendors might only allow their use in EPUB publications if the fonts are bound in some way to the EPUB publication. That is, if the font file cannot be installed directly for use on an operating system with the built-in tools of that computing device, and it cannot be directly used by other EPUB publications.
It is beyond the scope of this specification to provide a digital rights management or enforcement system for fonts. This section instead defines a method of obfuscation that will require additional work on the part of the final OCF recipient to gain general access to any obfuscated fonts.
This section is non-normative.
This specification does not claim that obfuscation constitutes encryption, nor does it guarantee that the resource will be secure from copyright infringement. The hope is only that this algorithm will meet the requirements of vendors who require some assurance that their fonts cannot be extracted simply by unzipping the OCF ZIP container and copying the resource.
Obfuscation, like any protection scheme, cannot fully protect fonts from being accessed in their deobfuscated state. The mechanism only provides an obstacle for those who are unaware of the license details. It will not prevent a determined user from gaining full access to the font through such alternative means as:
- applying the deobfuscation algorithm to extract the raw font file;
- accessing the deobfuscated font through a reading system that must deobfuscate it to render the content (e.g., by accessing the resources through a browser-based reading system); or
- accessing the deobfuscated font through authoring tools that provide the visual rendering of the content.
As a result, whether this method of obfuscation satisfies the requirements of individual font licenses remains a question for the licensor and licensee. EPUB creators are responsible for ensuring their use of obfuscation meets font licensing requirements.
EPUB creators should also be aware that obfuscation may lead to interoperability issues in reading systems as reading systems are not required to deobfuscate fonts. As a result, the visual presentation of their publications may differ from reading system to reading system.
Also note that the algorithm is restricted to obfuscating fonts. It is not intended as a general-purpose mechanism for obfuscating any resource in the EPUB container.
EPUB creators MUST derive the key used in the obfuscation algorithm from the unique identifier.
All whitespace characters, as defined in section 2.3 of the XML
1.0 specification [xml], MUST be removed from this identifier — specifically, the
Unicode code points U+0020, U+0009, U+000D and
U+000A.
EPUB creators MUST generate a SHA-1 digest of the UTF-8 representation of the resulting string as specified by the Secure Hash Standard [fips-180-4]. They can then use this digest as the key for the algorithm.
The algorithm employed to obfuscate fonts consists of modifying the first 1040 bytes (~1KB) of the font file. (In the unlikely event that the font file is less than 1040 bytes, this process will modify the entire file.)
To obfuscate the original data, store, as the first byte of the embedded font, the result of performing a logical exclusive or (XOR) on the first byte of the raw font file and the first byte of the obfuscation key.
Repeat this process with the next byte of source and key and continue for all bytes in the key. At this point, the process continues starting with the first byte of the key and 21st byte of the source. Once 1040 bytes are encoded in this way (or the end of the source is reached), directly copy any remaining data in the source to the destination.
EPUB creators MUST obfuscate fonts before compressing and adding them to the OCF ZIP container. Note that as obfuscation is not encryption, this requirement is not a violation of
the one in 4.2.6.3.2 Encryption file (encryption.xml) to compress fonts before
encrypting them.
The following pseudo-code exemplifies the obfuscation algorithm.
- set ocf to OCF ZIP container file
- set source to font file
- set destination to obfuscated font file
- set keyData to key for file
- set outer to 0
-
while outer < 52 and not (source at EOF)
- set inner to 0
-
while inner < 20 and not (source at EOF)
- read 1 byte from source (Assumes read advances file position)
- set sourceByte to result of read
- set keyByte to byte inner of keyData
- set obfuscatedByte to (sourceByte XOR keyByte)
- write obfuscatedByte to destination
- increment inner
- increment outer
-
if not (source at EOF) then
- read source to EOF
- write result of read to destination
- Deflate destination
- store destination as source in ocf
Although not technically encrypted data, all obfuscated fonts MUST have an entry in the encryption.xml file accompanying the EPUB publication (see 4.2.6.3.2 Encryption file (encryption.xml)).
EPUB creators MUST specify an EncryptedData element for each obfuscated font.
Each EncryptedData element MUST contain a child EncryptionMethod
element whose Algorithm attribute has the value
http://www.idpf.org/2008/embedding. The presence of this attribute signals the
use of the algorithm described in this specification.
EPUB creators MUST list the path to the obfuscated font in the CipherReference child
of the CipherData element. As the obfuscation algorithm is restricted to fonts, the
URI attribute of the CipherReference element MUST reference a Font core media type resource.
To prevent trivial copying of the embedded font to other EPUB publications, EPUB creators MUST NOT provide the obfuscation key in the encryption.xml
file.
All [xml] elements defined in this section are in the http://www.idpf.org/2007/opf
namespace [xml-names] unless otherwise specified.
This section is non-normative.
The package document is an XML document that consists of a set of elements that each encapsulate information about a particular aspect of an EPUB publication. These elements serve to centralize metadata, detail the individual resources, and provide the reading order and other information necessary for its rendering.
The following list summarizes the information found in the package document:
-
Metadata — mechanisms to include and/or reference information about the EPUB publication.
-
A manifest — identifies via URL [url], and describes via MIME media type [rfc4839], the set of publication resources.
-
A spine — an ordered sequence of ID references to top-level resources in the manifest from which reading systems can reach or utilize all other resources in the set. The spine defines the default reading order.
-
Collections — a method of encapsulating and identifying subcomponents within the EPUB publication.
-
Manifest fallback chains — a mechanism that defines an ordered list of top-level resources as content equivalents. A reading system can then choose between the resources based on which it is capable of rendering.
Note
An EPUB publication can reference more than one package document, allowing for alternative
representations of the content. For more information, refer to 4.2.6.3.1 Container file (container.xml)
Note
Refer to I.1 The application/oebps-package+xml media type for information about the file
properties of package documents.
To parse a URL string url used in the package document, the URL parser [url] MUST be applied to url, with the content URL of the package document as base.
This section provides definitions for shared attributes (i.e., attributes allowed on two or more elements).
Note
The dir attribute is marked under-implemented
as reading systems often only support a single default directionality for text display.
EPUB creators are still strongly encouraged to set the proper directionality of text
values in the package document to ensure proper rendering once this situation
improves.
Specifies the base direction [bidi] of the textual content and attribute values of the carrying element and its descendants.
Allowed values are:
ltr— left-to-right base direction;rtl— right-to-left base direction; andauto— base direction is determined using the Unicode Bidi Algorithm [bidi].
Reading systems will assume the
value auto when EPUB creators omit the attribute or use an invalid value.
Note
The base direction specified in the dir attribute does not affect the ordering
of characters within directional runs, only the relative ordering of those runs and the
placement of weak directional characters such as punctuation.
Allowed on: , Dublin Core elements, collection, and
meta.package
A valid URL string [url] that references a resource.
The URL string MUST NOT reference resources via elements in the package document (e.g., via a
manifest or spine item declaration).itemref
The ID [xml] of the element, which MUST be unique within the document scope.
Allowed on: , Dublin Core elements, collection,
item, itemref, link, manifest, meta, and package.spine
A media type [rfc2046] that specifies the type and format of the referenced resource.
A space-separated list of property values.
Refer to each element's definition for the reserved vocabulary for the attribute.
Establishes an association between the current expression and the element or resource identified
by its value. EPUB creators MUST use as the value a path-relative-scheme-less-URL string, optionally followed by U+0023 (#) and a URL-fragment string that
references the resource or element they are describing.
The refines attribute is OPTIONAL depending on the type of metadata expressed. When
omitted, the element defines a primary expression.
When creating expressions about a publication resource, the refines attribute
SHOULD specify a fragment identifier that references the ID [xml] of
the resource's manifest entry.
Refinement chains MUST NOT contain circular references or self-references.
Specifies the language of the textual content and attribute values of the carrying element and
its descendants, as defined in section 2.12 Language
Identification of [xml]. The value of each xml:lang attribute MUST be a
well-formed language tag [bcp47].
Allowed on: , Dublin Core elements, collection, and
meta.package
The package element encapsulates all the information expressed in the package document.
- Element Name:
-
package - Usage:
-
REQUIRED root element [xml] of the package document.
- Attributes:
- Content Model:
-
In this order:
-
metadata[exactly 1] -
manifest[exactly 1] -
spine[exactly 1] -
bindings[0 or 1](deprecated) -
collection[0 or more]
-
The version attribute specifies the EPUB specification
version to which the given EPUB publication conforms. The attribute MUST have the value
"3.0" to indicate conformance with EPUB 3.
Note
Updates to this specification do not represent new versions of EPUB 3 (i.e., each new 3.X
specification is a continuation of the EPUB 3 format). The Working Group is committed to
minimizing any changes that would invalidate existing content, allowing the version
attribute value to remain unchanged.
The unique-identifier attribute takes an IDREF
[xml] that identifies the element that provides the preferred, or primary,
identifier.dc:identifier
The prefix attribute provides a declaration mechanism for
prefixes not reserved by this specification. Refer to
D.1.4 The prefix attribute for more information.
The metadata element encapsulates meta information.
- Element Name:
-
metadata - Usage:
-
REQUIRED first child of
.package - Attributes:
-
None
- Content Model:
-
In any order:
-
dc:identifier[1 or more] -
dc:title[1 or more] -
dc:language[1 or more] -
Dublin Core Optional Elements[0 or more] -
meta[1 or more] -
link[0 or more]
-
The package document metadata element has two primary functions:
-
to provide a minimal set of meta information for reading systems to use to internally catalogue an EPUB publication and make it available to a user (e.g., to present in a bookshelf).
-
to provide access to all rendering metadata needed to control the layout and display of the content (e.g., fixed-layout properties).
The package document does not provide complex metadata encoding capabilities. If EPUB creators need to provide more detailed information, they can associate metadata records (e.g.,
that conform to an international standard such as [onix] or are created for custom purposes)
using the element. This approach allows reading systems to process the metadata in its
native form, avoiding the potential problems and information loss caused by translating to use
the minimal package document structure.link
In keeping with this philosophy, the package document only has the
following minimal metadata requirements: it MUST contain the [dcterms] ,
dc:title, and dc:identifier elements together with the [dcterms]
dc:language property. All other metadata is OPTIONAL.dcterms:modified
The element provides a generic mechanism for including metadata properties from any vocabulary. Although EPUB creators MAY use this mechanism
for any metadata purposes, they will typically use it to include rendering metadata defined in
EPUB specifications.meta
Note
See [epub-a11y-11] for accessibility metadata recommendations.
The Dublin Core elements [dcterms] and element have mandatory child text content
[dom]. In the descriptions for these elements, this specification refers to this content as
the element's value .meta
These elements MUST have non-empty values after leading and trailing ASCII whitespace [infra] is stripped (i.e., they must consist of at least one non-whitespace character).
Whitespace within these element values is not significant. Sequences of one or more whitespace characters are collapsed to a single space [infra] during processing .
The dc:identifier element [dcterms] contains an identifier such as a UUID, DOI or ISBN.
- Element Name:
-
dc:identifier - Namespace:
-
http://purl.org/dc/elements/1.1/ - Usage:
-
REQUIRED child of
. Repeatable.metadata - Attributes:
-
-
id[conditionally required]
-
- Content Model:
-
Text
The EPUB creator MUST provide an identifier that is unique to one and only one EPUB publication — its unique identifier — in an dc:identifier element.
This dc:identifier element MUST specify an id attribute whose
value is referenced from the element's packageunique-identifier
attribute.
Although not static, EPUB creators should make changes to the unique identifier for an EPUB publication as infrequently as possible. Unique Identifiers should have maximal persistence both for referencing and distribution purposes. EPUB creators should not issue new identifiers when making minor revisions such as updating metadata, fixing errata, or making similar minor changes.
EPUB creators MAY specify additional identifiers.
Note
EPUB creators are advised to use absolute-URL strings [url] for identifiers whenever possible. The inclusion of a domain owned by the EPUB creator can improve the uniqueness of the identifier, for example, while the use of a URN with a namespace identifier [rfc8141] improves processing by reading systems.
EPUB creators MAY use the identifier-type
property to indicate that the value of a dc:identifier element
conforms to an established system or an issuing authority granted it.
The dc:title element [dcterms] represents an instance of a name for the
EPUB publication.
- Element Name:
-
dc:title - Namespace:
-
http://purl.org/dc/elements/1.1/ - Usage:
-
REQUIRED child of
. Repeatable.metadata - Attributes:
- Content Model:
-
Text
The first dc:title element in document order is the main
title of the EPUB publication (i.e., the primary one reading systems present to
users).
EPUB creators should use only a single dc:title element to ensure
consistent rendering of the title in reading systems.
Note
Although it is possible to include more than one dc:title element for
multipart titles, reading system support for additional dc:title
elements is inconsistent. Reading systems may ignore the additional segments or
combine them in unexpected ways.
For example, the following example shows a basic multipart title:
<metadata …>
<dc:title>
THE LORD OF THE RINGS
</dc:title>
<dc:title>
Part One: The Fellowship of the Ring
</dc:title>
…
</metadata>
The same title could instead be expressed using a single dc:title
element as follows:
<metadata …>
<dc:title>
THE LORD OF THE RINGS, Part One:
The Fellowship of the Ring
</dc:title>
…
</metadata>
Previous versions of this specification recommended using the title-type and display-seq properties to identify and
format the segments of multipart titles (see the Great
Cookbooks example). It is still possible to add these semantics, but they
are also not well supported.
The dc:language element [dcterms] specifies the language of the content of
the EPUB publication.
- Element Name:
-
dc:language - Namespace:
-
http://purl.org/dc/elements/1.1/ - Usage:
-
REQUIRED child of
. Repeatable.metadata - Attributes:
-
id[optional] - Content Model:
-
Text
The value of each dc:language element MUST be a well-formed language tag [bcp47].
Although EPUB creators MAY specify additional dc:language elements for
multilingual Publications, reading systems will treat the first
dc:language element in document order as the primary language of the
EPUB publication.
Note
Publication resources do not inherit their language from the
dc:language element(s). EPUB creators must set the language of a
resource using the intrinsic methods of the format.
All [dcterms] elements except for , dc:identifier, and dc:language
are designated as OPTIONAL. These elements conform to the following generalized
definition:dc:title
- Element Name:
-
dc:contributor|dc:coverage|dc:creator|dc:date|dc:description|dc:format|dc:publisher|dc:relation|dc:rights|dc:source|dc:subject|dc:type - Namespace:
-
http://purl.org/dc/elements/1.1/ - Usage:
-
OPTIONAL child of
. Repeatable.metadata - Attributes:
- Content Model:
-
Text
This specification does not modify the [dcterms] element definitions except as noted in the following sections.
The dc:contributor element [dcterms] is used to represent the
name of a person, organization, etc. that played a secondary role in the creation of the
content.
The requirements for the dc:contributor element are identical to those for
the element in all other respects.dc:creator
The dc:creator element [dcterms] represents the name of a
person, organization, etc. responsible for the creation of the content. EPUB creators MAY associate a role property with the element to indicate the function the
creator played.
The dc:creator element should contain the name of the creator as EPUB
creators intend reading systems to display it to users.
EPUB creators MAY use the file-as property
to associate a normalized form of the creator's name, and
the alternate-script property to represent
the creator's name in another language or script.
If an EPUB publication has more than one creator, EPUB creators should specify each
in a separate dc:creator element.
The document order of dc:creator elements in the metadata
section determines the display priority, where the first dc:creator element
encountered is the primary creator.
EPUB creators should represent secondary contributors using the
element.dc:contributor
The dc:date element [dcterms] defines the publication date of the
EPUB publication. The publication date is not the same as the last modified date (the last time the EPUB creator changed the EPUB publication).
It is RECOMMENDED that the date string conform to [iso8601-1], particularly the subset expressed in W3C Date and Time Formats [datetime], as such strings are both human and machine readable.
EPUB creators should express additional dates using the specialized date properties available in the [dcterms] vocabulary, or similar.
EPUB publications MUST NOT contain more than one dc:date element.
The dc:subject element [dcterms] identifies the subject of the
EPUB publication. EPUB creators should set the value of the element to the
human-readable heading or label, but may use a code value if the subject taxonomy does
not provide a separate descriptive label.
EPUB creators MAY identify the system or scheme they drew the element's value from
using the authority property.
When a scheme is identified, EPUB creators MUST associate a
subject code using the term property.
The term property MUST NOT be associated with a
dc:subject element that does not specify a scheme.
The values of the dc:subject element and term property are
case sensitive only when the designated scheme requires.
The dc:type element [dcterms] is used to indicate that the EPUB publication is of a specialized type (e.g., annotations or a dictionary packaged in
EPUB format).
EPUB creators MAY use any text string as a value.
The meta element provides a generic means of including package metadata.
- Element Name:
-
meta - Usage:
-
As child of the
element. Repeatable.metadata - Attributes:
- Content Model:
-
Text
Each meta element defines a metadata expression. The
property attribute takes a property
data type value that defines the statement made in the expression, and the text content
of the element represents the assertion. (Refer to D.1 Vocabulary association mechanisms for more
information.)
This specification defines two types of metadata expressions that EPUB creators can define using the meta element:
- A primary expression is one in which the expression defined
in the
metaelement establishes some aspect of the EPUB publication. Ametaelement that omits a refines attribute defines a primary expression. - A subexpression is one in which the expression defined in the
metaelement is associated with another expression or resource using therefinesattribute to enhance its meaning. A subexpression might refine a media clip, for example, by expressing its duration, or refine a creator or contributor expression by defining the role of the person.
EPUB creators MAY use subexpressions to refine the meaning of other subexpressions, thereby creating chains of information.
Note
All the [dcterms] elements represent primary expressions, and permit refinement by meta element subexpressions.
The Meta Properties Vocabulary is the default vocabulary for use with the property
attribute.
EPUB creators MAY add terms from other vocabularies as defined in D.1 Vocabulary association mechanisms.
The scheme attribute identifies the system or scheme the EPUB
creator obtained the element's value from. The value of the attribute MUST be a property data type value that resolves to the
resource that defines the scheme. The scheme attribute does not have a default vocabulary (i.e., all values require a prefix).
The metadata section MUST contain exactly one dcterms:modified property [dcterms]
containing the last modification date. The value of this property MUST be an [iso8601-1]
complete representation of a date and time of day matching the extended format:
YYYY-MM-DDThh:mm:ssZ
EPUB creators MUST express the last modification date in Coordinated Universal Time (UTC) and
MUST terminate it with the "Z" (Zulu) time zone indicator.
EPUB creators should update the last modified date whenever they make changes to the EPUB publication.
EPUB creators MAY specify additional modified properties in the package document metadata,
but they MUST have a different subject (i.e., they require a refines attribute that
references an element or resource).
Note
The requirements for the last modification date are to ensure compatibility with earlier versions of EPUB 3 that defined a release identifier [epubpackages-32] for EPUB publications.
The link element associates resources with an EPUB publication, such as metadata
records.
- Element Name:
-
link - Usage:
-
As a child of
. Repeatable.metadata - Attributes:
-
-
href[required] -
hreflang[optional] -
id[optional] -
media-type[conditionally required] -
properties[optional] -
refines[optional] -
rel[required]
-
- Content Model:
-
Empty
The element MAY contain zero or more metadatalink elements, each of which
identifies the location of a publication resource or a linked resource in its REQUIRED
href attribute.
Resources referenced from the link element are
publication resources only when they are:
-
referenced from the spine; or
-
included or embedded in an EPUB content document (e.g., a metadata record serialized as RDFa [rdfa-core] or as JSON-LD [json-ld11] embedded in an [html]
scriptelement).
In all other cases (e.g., when linking to standalone [onix] records), the resources referenced are not publication resources (i.e., are not subject to core media type requirements) and EPUB creators MUST NOT list them in the manifest.
EPUB creators MAY locate linked resources within the EPUB container or externally, but should consider that reading systems are not required to retrieve resources outside the EPUB container.
The media-type
attribute is OPTIONAL when a linked resource is located outside the EPUB container, as
more than one media type could be served from the same URL [url]. EPUB creators MUST specify
the attribute for all linked resources within the EPUB container.
The OPTIONAL hreflang attribute identifies the language of the
linked resource. The value MUST be a well-formed language
tag [bcp47].
The REQUIRED rel attribute takes a space-separated list of property values that establish the relationship the linked
resource has with the EPUB publication.
The value of the media-type attribute is not always sufficient to identify the type
of linked resource (e.g., many XML-based record formats use the media type
"application/xml"). To aid reading systems in the identification of such
generic resources, EPUB creators MAY specify a semantic identifier in the
properties attribute.
The Metadata Link Vocabulary is the default vocabulary for the rel and properties attributes.
EPUB creators MAY add relationships and properties from other vocabularies as defined in D.1 Vocabulary association mechanisms.
EPUB creators MAY provide one or more linked metadata records.
Note
Due to the variety of metadata record formats and serializations that an EPUB creator can link to an EPUB publication, and the complexity of comparing metadata properties between them, this specification does not require reading systems to process linked records.
In addition to full records, EPUB creators MAY also use the link element to identify
individual metadata properties available in an alternative format.
The manifest element provides an exhaustive list of publication resources used
in the rendering of the content.
With the exception of the package document, the
manifest MUST list all publication resources regardless of whether they are
container resources or remote resources.
As the package document is already identified by the container.xml file, the
manifest MUST NOT specify an item element for it (i.e., a
self-reference serves no purpose).
Note
The manifest is only for listing publication resources. Linked resources and the special files for processing the OCF
Container (i.e., files in the META-INF directory, and the
mimetype file) are restricted from inclusion.
Failure to provide a complete manifest of publication resources may lead to rendering issues. Reading systems might not unzip such resources or could prevent access to them for security reasons.
The item element represents a publication resource.
- Element Name:
-
item - Usage:
-
As a child of
. Repeatable.manifest - Attributes:
-
-
fallback[conditionally required] -
href[required] -
id[required] -
media-overlay[optional] -
media-type[required] -
properties[optional]
-
- Content Model:
-
Empty
Each item element identifies a publication resource by the
URL [url] in its href attribute. The value MUST be an
absolute- or path-relative-scheme-less-URL
string [url]. EPUB creators MUST ensure each URL is unique within the
manifest scope after parsing.
The publication resource identified by an item element
MUST conform to the applicable specification(s) as inferred from the MIME media type [rfc2046]
provided in the media-type attribute. For core media type resources, EPUB creators MUST use the media type designated in 3.2 Core media types.
The fallback attribute specifies the fallback for the
referenced publication resource. The fallback attribute's IDREF [xml] value MUST resolve to another item in the
manifest.
The fallback for one item MAY specify a fallback to another item, and
so on, creating a chain of fallback options. Refer to 3.5.1 Manifest fallbacks for
additional requirements related to the use of fallback chains.
The media-overlay attribute takes an IDREF [xml]
that identifies the media overlay document for the resource described by this
item. Refer to 9.3.5 Media overlays packaging for more information.
Note
The order of item elements in the manifest is not significant. The
element provides the presentation sequence of content documents.spine
The properties attribute provides information
to reading systems about the content of a resource. This information enables discovery
of key resources, such as the cover image and EPUB navigation document. It also allows
reading systems to optimize rendering by indicating, for example, whether the resource
contains embedded scripting, MathML, or SVG.
The Manifest Properties
Vocabulary is the default vocabulary for the
properties attribute.
EPUB creators MUST set the following properties whenever a resource referenced by an
item element matches their respective definitions:
These properties do not apply recursively to content included into a resource (e.g., via the
[html] iframe element). For example, if a non-scripted XHTML content document
embeds a scripted content document, only the embedded document's manifest
item
properties attribute will have the scripted value.
EPUB creators MUST declare exactly one item as the EPUB navigation document
using the nav property.
If an EPUB publication contains a cover image, it is recommended to set the cover-image property, but setting this property
is OPTIONAL.
EPUB creators MAY add terms from other vocabularies as defined in D.1 Vocabulary association mechanisms.
The bindings element defines a set of custom handlers for media types not supported
by this specification.
Use of the element is deprecated.
Refer to the bindings element definition in [epubpublications-301] for more
information.
The spine element defines an ordered list of manifest
item references that represent the default reading order.
- Element Name:
-
spine - Usage:
- Attributes:
-
-
id[optional] -
page-progression-direction[optional]
-
- Content Model:
-
itemref[1 or more]
The spine MUST specify at least one EPUB content document or foreign content document.
EPUB creators MUST list in the spine all EPUB and
foreign content documents that are hyperlinked to from publication resources in the
spine, where hyperlinking encompasses any linking mechanism that requires the
user to navigate away from the current resource. Common hyperlinking mechanisms include the
href attribute of the [html] a and area elements and scripted links (e.g., using
DOM Events and/or form elements). The requirement to list hyperlinked resources applies
recursively (i.e., EPUB creators must list all EPUB and foreign content documents hyperlinked to
from hyperlinked documents, and so on.).
EPUB creators also MUST list in the spine all EPUB and foreign content documents
hyperlinked to from the EPUB navigation document, regardless of whether EPUB creators
include the EPUB navigation document in the spine.
Note
As hyperlinks to resources outside the EPUB container are not publication resources, they are not subject to the requirement to include in the spine (e.g., web pages and web-hosted resources).
Publication resources used in the rendering of spine items (e.g., referenced from [html] embedded content) similarly do not have to be included in the spine.
The page-progression-direction
attribute sets the global direction in which the content flows. Allowed values are
ltr (left-to-right), rtl (right-to-left) and default.
When EPUB creators specify the default value, they are expressing no preference and
the reading system can choose the rendering direction.
Although the page-progression-direction attribute sets the global flow direction,
individual EPUB content documents and parts of EPUB content documents MAY override this setting
(e.g., via the writing-mode CSS property). Reading systems may also provide
mechanisms to override the default direction (e.g., buttons or settings that allow the
application of alternate style sheets).
The legacy
toc attribute takes an IDREF [xml] that identifies
the manifest item that represents the NCX.
The itemref element identifies an EPUB content document or foreign content document in the default reading order.
- Element Name:
-
itemref - Usage:
-
As a child of
. Repeatable.spine - Attributes:
-
-
id[optional] -
idref[required] -
linear[optional] -
properties[optional]
-
- Content Model:
-
Empty
Each itemref element MUST reference the ID [xml] of an in the manifest via the
IDREF [xml] in its itemidref attribute.
item element IDs MUST NOT be referenced more than once.
Each referenced manifest item MUST be either a) an
EPUB content document or b) a foreign content document that includes an EPUB content
document in its manifest fallback chain.
Note
Although EPUB publications require an EPUB navigation document, it is not mandatory to include it in the spine.
The linear attribute indicates whether the referenced
item contains content that contributes to the primary reading order and that
reading systems must read sequentially ("yes"), or auxiliary content that
enhances or augments the primary content that reading systems can access out of sequence
("no"). Examples of auxiliary content include notes, descriptions, and answer
keys.
The linear attribute allows reading systems to distinguish content that a user
should access as part of the default reading order from supplementary content which a reading
system might, for example, present in a popup window or omit from an aural rendering.
Specifying that content is non-linear does not require reading systems to present it in a specific way, however; it is only a hint to the purpose. Reading systems may present non-linear content where it occurs in the spine, for example, or may skip it until users reach the end of the spine.
Note
EPUB creators should list non-linear content at the end of the spine except when it makes sense for users to encounter it between linear spine items.
A linear itemref element is one whose linear
attribute value is explicitly set to "yes" or that omits the
attribute — reading systems will assume the value "yes" for
itemref elements without the attribute. The spine MUST contain at least one
linear itemref element.
EPUB creators MUST provide a means of accessing all non-linear content (e.g., hyperlinks in the content or from the EPUB navigation document).
The Spine Properties
Vocabulary is the default vocabulary for the
properties attribute.
EPUB creators MAY add terms from other vocabularies as defined in D.1 Vocabulary association mechanisms.
The collection element defines a related group of resources.
- Element Name:
-
collection - Usage:
-
OPTIONAL sixth element of
package. Repeatable. - Attributes:
- Content Model:
-
In this order:
metadata[0 or 1], (collection[1 or more]or (collection[0 or more],link[1 or more]))
The collection element allows EPUB creators to assemble resources into logical
groups for a variety of potential uses: enabling reassembly into a meaningful unit of content
split across multiple EPUB content documents (e.g., an index split across multiple
documents), identifying resources for specialized purposes (e.g., preview content), or
collecting together resources that present additional information about the EPUB publication.
EPUB creators MUST identify the role of each collection
element in its role attribute, whose value MUST be one or more NMTOKENs
[xmlschema-2] and/or absolute-URL-with-fragment strings [url].
The requirements for authoring specialized collections are defined by their respective specifications.
Note
The creation of new collection element roles is now deprecated.
Refer to the collection element definition in [epubpackages-32] for more
information about the creation of specialized collections, including the requirements and
restrictions on their use.
The package document legacy features are retained from EPUB 2 only to allow EPUB creators to author content that can function, to some degree, in reading systems that only support EPUB 2 publications.
These features were added primarily to address the overlap period as EPUB 3 reading systems were developed, as there was still a high probability at that time that users would be opening EPUB 3 publications on EPUB 2 reading systems.
As reading systems that only handle EPUB 2 publications are now rare, EPUB creators should consider the likelihood of their publications still being opened on these types of older devices before making the effort to add these legacy features.
EPUB creators MAY include the legacy features defined in this section for compatibility purposes with EPUB 2 reading systems.
EPUB 3 reading systems will not use these features when presenting publications to users.
Note
EPUB conformance checkers should not alert EPUB creators about the presence of legacy features in an EPUB publication, as their inclusion is valid for backwards compatibility. EPUB conformance checkers must alert EPUB creators if a legacy feature does not conform to its definition or otherwise breaks a usage requirement.
The meta
element [opf-201] provides a means of including generic metadata for EPUB 2 reading systems.
Refer to the meta element definition in [opf-201] for more information.
Note
The EPUB 3 element, which uses different attributes and requires text content,
provides metadata capabilities for EPUB 3 reading systems.meta
The [opf-201] meta element also allows EPUB creators to identify a cover
image for EPUB 2 reading systems. In EPUB 3, the cover image must be identified using the cover-image property on the manifest
for the image.item
The guide
element [opf-201] provides machine-processable navigation to key structures in
EPUB 2 reading systems.
Refer to the guide element definition in [opf-201] for more information.
Note
The landmarks nav in the EPUB navigation document provides this functionality in EPUB 3 reading systems.
The NCX [opf-201] provides a table of contents for EPUB 2 reading systems.
Refer to the NCX definition in [opf-201] for more information.
Note
The EPUB navigation document replaces the NCX for EPUB 3 reading systems.
This section is non-normative.
This section defines a profile of [html] for creating XHTML content documents. An instance of an XML document that conforms to this profile is a core media type resource and is referred to in this specification as an XHTML content document.
-
MUST conform to the conformance criteria for all document constructs defined by [html] unless explicitly overridden in 6.1.4 HTML deviations and constraints.
-
MAY include extensions to the [html] grammar as defined in 6.1.3 HTML extensions, and MUST conform to all content conformance constraints defined therein.
Unless specified otherwise, XHTML content documents inherit all definitions of semantics, structure, and processing behaviors from the [html] specification.
Note
The recommendation that EPUB publications follow the accessibility requirements in [epub-a11y-11] applies to XHTML content documents. See Accessibility.
This section defines EPUB 3 XHTML content document extensions to the underlying [html] document model.
Note
Although [html] allows user agents to support vendor-neutral extensions, unless such extensions are listed in this section, they are not supported features of EPUB 3.
EPUB creators MAY use the attribute in XHTML content documents to
express structural semantics.epub:type
The attribute MUST NOT be used on the head element or metadata content [html].
The [html-rdfa] specification defines a set of attributes that EPUB creators MAY use in XHTML content documents to semantically enrich the content. The use of these attributes MUST conform to the requirements defined in [html-rdfa].
The [html-rdfa] specification defines changes to the [html] content model when authors use RDFa attributes. This modified content model is valid in XHTML content documents.
Note
The listing of RDFa does not express a preference on the part of the Working Group, only that these attributes represent an extension of the HTML grammar. EPUB creators can also specify microdata attributes [html] and linked data [json-ld11] in XHTML content documents as both are natively supported.
The switch element provides a simple mechanism through which EPUB creators
can tailor the content displayed to users, one that is not dependent on the scripting
capabilities of the EPUB reading system.
Use of the element is deprecated.
Refer to the switch element definition in [epubcontentdocs-301] for more
information.
The trigger element enables the creation of markup-defined user interfaces for
controlling multimedia objects, such as audio and video playback, in both scripted and
non-scripted contexts.
Use of the element is deprecated.
Refer to the epub:trigger element definition in [epubcontentdocs-301]
for more information.
XHTML content documents MAY contain custom attributes, which are prefixed [xml-names] attributes whose namespace URL does not include either of the following strings in its domain [url]:
w3.orgidpf.org
When using custom attributes, the content MUST remain consumable by a user without any information loss or other significant deterioration, regardless of the reading system it is rendered on.
Note
Custom attributes are usually defined in a reading system-specific manner and are not intended for use by other reading systems. This specification should be extended to provide extensions that multiple independent reading systems can use.
This section defines deviations from, and constraints on, the underlying [html] document model applicable to EPUB 3 XHTML content documents.
XHTML content documents support embedded [mathml3]. Occurrences of MathML markup MUST conform to the constraints expressed in the MathML specification [mathml3], with the following additional restrictions:
- Presentation MathML
-
The
mathelement MUST contain only Presentation MathML, except within theannotation-xmlelement. - Content MathML
-
EPUB creators MAY include Content MathML within MathML markup in XHTML content documents, and, when present, MUST include it within an
annotation-xmlchild element of asemanticselement.When EPUB creators include Content MathML per the previous condition, they MUST set the given
annotation-xmlelement'sencodingattribute to either of the functionally-equivalent valuesMathML-Contentorapplication/mathml-content+xml, and thenameattribute tocontentequiv.
This subset eases the implementation burden on reading systems and promotes accessibility, while retaining compatibility with ["https://www.w3.org/TR/epu