GUIDE FOR CREATE EBOOKS IN EPUB FORMAT USING XSLT 2.0
Tool that converts automaticly XML to format epub format, developed with XSLT 2.0.
Epub What is?
It is an optimum format to be reproduced in electronic ink books Sony Reader (PRS-700 PRS-505) and BeBook. It can also be played on an iPhone using Stanza program.
How to read a Epub into an iPhone using Stanza: http://toc.oreilly.com/2008/08/how-to-read-oreilly-epub-ebook.html
How do I read a Epub on my PC?
Adobe digital Editions
FBReader
Introduccion
The epub creation format is quite simple since it is a packaged format files of type xml and XHTML, easy to create.
An interesting link with information to begin developing this format is epub Epub Format Construction Guide.
Tools used
Saxon 8.1
XSTL 2.0
How to create an epub?
Epub A is a packaged set of files in a zip file, which was renamed in epub. This file has a specific directory structure and files.
Must first create a file called mimetype, this file should be at the root of epub, the content should be: application/epub+zip
Then we create two directories that were also at the root.
META-INF
OEBPS
Inside the META-INF directory there will be a file called conatiner.xml, with the following contents:
<?xml version='1.0' encoding='utf-8'?>
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
<rootfiles>
<rootfile full-path="OEBPS/package.opf" media-type="application/oebps-package+xml" />
</rootfiles>
</container>
This file is in your part of the epub file, which contains information on all elements that appear in the epub, package.opf file. We can say as we wish, whether it should be extenció. OPF. This file is inside the folder OEBPS.
package.opf The file has the following structure:
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="assignaturaId">
<metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/">
</metadata>
<manifest>
</manifest>
<spine>
</spine>
</package>
Within the metadata will tag metadata file that we created in Dublin Core format. Some of them are mandatory. To start working with these is enough:
<dc:title></dc:title>
<dc:publisher></dc:publisher>
<dc:language>ca</dc:language>
<dc:rights>OMAONK</dc:rights>
<dc:identifier id="assignaturaId">XX08_M2004_00603</dc:identifier>
<dc:creator>omaonk</dc:creator>
It is very important dc: identifier since it is the unique identifier Epub.
The Manifes ttag contains a reference to anything that contains Epub, images and HTML files. Every file type that we should be associated with the media-type, the ID is also very important because each item must be identified with a unique value.
<manifest>
<item id="ncx" href="toc.ncx" media-type="text/xml"/>
<item id="main" href="main.html" media-type="application/xhtml+xml"/>
<item id="d28e1385" href="images/imatge1.gif" media-type="image/gif"/>
....
</manifest>
The tag spin refers to all the XHTML pages that are part of epub, ie all XHTML pages that appeared to me the tag and want to be shown from within the linkables Epub.
<spine toc="ncx">
<itemref idref="main"/>
</spine>
Inside the tag is shown referenced a file called toc.ncx.
<item id="ncx" href="toc.ncx" media-type="text/xml"/>
The toc.ncx file contains Epub structure, when Epub reader (ebook) we see that file, display the document structure so we can navigate through them.
The file structure is:
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
<head>
<meta name="dtb:uid" content="XXX"/>
</head>
<docTitle>
<text>Exemple epub</text>
</docTitle>
<docAuthor>
<text>Omaonk</text>
</docAuthor>
<navMap>
<navPoint id="navPoint-d28e166" playOrder="4">
<navLabel>
<text>Introducció</text>
</navLabel>
<content src="introduccio.html"/>
</navPoint>
<navPoint id="navPoint-d28e196" playOrder="5">
<navLabel>
<text>Objectius</text>
</navLabel>
<content src="objectius.html"/>
</navPoint>
</navMap>
</ncx>
The tag head to contain a meta name = "DTB: uid" should have value the same as dc: identifier of package.opf.
docTile is the title of the book and docAuthor is the author / authors.
Finally navMap with the way we navigate between chapters and sections of the book.
<navPoint id="navPoint-d28e166" playOrder="4">
<navLabel>
<text>Introducció</text>
</navLabel>
<content src="introduccio.html"/>
</navPoint>
navPoint mark each of the sections to which we can navigate normally chapters, introduction, bibliography, ...
navLabel: Section title.
content: What html bind.
playOrder: in order to be read in sections.
The navPoint may contain navPoints, thus creating a tree structure.
Also can refer to parts within a html file:
<content src="modul_1.html#d28e781"/>
In this case the div with id = jumps d28e781 within modul_1.html file.
File ncx allows Epub create a multiple html or html.
Inside there will OEBPS which we refer to the HTML, images and css.
Structure we have:
/epub
/OEBPS
fitxers html
imatges
css
package.opf
toc.ncx
/META-INF
container.xml
mimetype
Now let's create the file Epub.
Compressed with a zip directory where we have all these files with extenció Epub.
We unzipped the file mimetype
zip-q0X document.epub mimetype
Other files
zip-qXr9D document.epub *
Here we have Epub mounted.
Epub Example: contes d'Andersen
Rename the file. Epub and you can already see.
Contact ajuhe@omaonk.com.
Customers of this project
UOC - myWAy project
Interesting Links
International digital Publishing
Information & resources
