ePub creation - XML/HTML editing needed


I am trying to convert an MS Word document to ePub using Calibre tool. The concerned document is created by Calibre. Now in the epub,the headings and images are not coming in the center(when I test with different epub readers).

Trying to correct it. I believe it has to mentioned in the code that the alignment of these has to be in the center. If I share the code, can you help with it? Is it possible that I can paste the code here?

I am new to coding. I got a file called index.html. The first 2 lines in it are given below.

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

Is it an html or xml file?

Please help me out. Thanks in advance.

By the look of that code above, it’s an XML file, which is the norm for epubs.

I’m not familiar with Calibre, but I’d suggest looking into its documentation to see what it’s expecting from you. Web designers are always wary of Word, as it tends to bring a lot of ugly and troublesome code along with it. It might at least be worth looking at a cleaner format to start with (Markdown, or plain text?) so that you’ve not dumping a lot of Word garbage into Calibre.

Actually, Discourse ate a tag

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml"
 lang="en" xml:lang="en">

The namspace indicates it’s intended to be XHTML though whether or not it’s “pseudo” XHTML or “real” XHTML depends on what HTTP headers are being sent with it.


O, well spotted. Fixed. :slight_smile:


Is there a missing DOCTYPE?


<?xml version="1.0" encoding="UTF-8"?>
<html version="-//W3C//DTD XHTML 1.1//EN"
      xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
    <title>Virtual Library</title>
    <p>Moved to <a href="http://example.org/">example.org</a>.</p>

If I thought the W3C RFCs could be not so easy to digest, the EPUB specifications are on a par.


Looking briefly, I did not see a reference to DOCTYPE, but I did notice examples have a namespace that looks important to have eg.

<html … xmlns:epub="http://www.idpf.org/2007/ops">
    <p> … <a epub:type="noteref" href="#n1">1</a> … </p>    
    <aside epub:type="footnote" id="n1">
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.