XML technologies / ePUB / Open Publication Format / The Spine element

(Excerpt from “E-Books mit ePUB ─ Von Word zum E-Book mit XML” by Dr. Victor Wang)

The element <spine>, literally the backbone or book spine, is also mandatory in the OPF package. It primarily sets content-document order, determining page-turning sequence and reading flow.

Within <spine>, the sole element <itemref> points to content documents declared in the manifest. It is the counterpart of <item>. The reference attribute idref points to the id-value of an item-element and is mandatory.

Here is a simple example of the element <spine>:

<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="ISBN123456789X">
  . . .
  <manifest>
    <!-- NCX-Datei -->
    <itemid="ncx" href="nav.ncx" media-type="application/x-dtbncx+xml"/>    ②
    <!-- CSS-Stylesheet -->
    <item id="css" href="ebook.css" media-type="text/css"/>
    <!-- Liste der Dokumente -->
    <item id="kap01" href="kap01.htm" media-type="application/xhtml+xml"/>
    <item id="kap02" href="kap02.htm" media-type="application/xhtml+xml"/>
    <item id="kap03" href="kap03.htm" media-type="application/xhtml+xml"/>
    . . .
  </manifest>
  <spine toc="ncx">                       ①
     <itemref idref="kap01"/>
     <itemref idref="kap02"/>
     <itemref idref="kap03"/>
   . . .
 </spine>
  . . .
</package> 

Code example: Spine element

The spine list should contain every content document needed for navigation. As we will see, it underlies NCX and the elements <tours> and <guide>. Thus at ① the attribute toc of <spine> must match the value of id in the associated item manifest entry at ②.

Finally, itemref entries distinguish primary and secondary content using the optional attribute linear="yes|no". Its default is yes, assuming primary content. Secondary documents are unnecessary to the reading flow, for reference only, or deliberately hidden.

Our formula example could be such a case:

<manifest>
  <!-- NCX-Datei -->
  <item id="ncx" href="nav.ncx" media-type="application/x-dtbncx+xml"/>
  <!-- CSS-Stylesheet -->
  <item id="css" href="ebook.css" media-type="text/css"/>
  <item id="css2" href="mathml.css" media-type="text/css"/>
  <!-- Liste der Dokumente -->
  <item id="kap01" href="kap01.htm" media-type="application/xhtml+xml"/>
  <item id="kap01anhangmathml" href="kap01anh.xml" media-type="text/mathml" fallback="kap01anhanghtml" fallback-style="css2" required-namespace="http://www.w3.org/1998/Math/MathML"/>
  <item id="kap01anhanghtml" href="kap01anh.htm" media-type="application/xhtml+xml"/>
  <item id="kap02" href="kap02.htm" media-type="application/xhtml+xml"/>
  <item id="kap03" href="kap03.htm" media-type="application/xhtml+xml"/>
  . . .
</manifest>
<spine>
  <itemref idref="kap01"/>
  <itemref idref="kap01anhangmathml" linear="no"/>           ①
  <itemref idref="kap02"/>
  <itemref idref="kap03"/>
  . . .
</spine> 

Code example: Spine structure with fallback items

At ① the attribute linear="no" marks the MathML appendix as secondary. Its manifest fallback chain need not be repeated here.

Readers may, but need not, use this distinction for display: secondary content might open as a popup or through a link. Sequential page-turning is reserved for primary documents, skipping secondary ones.

   

 

 

 

back to top