ePub creation - XML/HTML editing needed

Hello,

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.

2 Likes

O, well spotted. Fixed. :slight_smile:

2 Likes

Is there a missing DOCTYPE?

https://en.wikipedia.org/wiki/Document_type_declaration

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html version="-//W3C//DTD XHTML 1.1//EN"
      xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.w3.org/1999/xhtml
                          http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
>
  <head>
    <title>Virtual Library</title>
  </head>
  <body>
    <p>Moved to <a href="http://example.org/">example.org</a>.</p>
  </body>
</html>

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

http://www.idpf.org/epub/30/spec/epub30-contentdocs.html

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">
        …    
    </aside>
    …
</html> 
1 Like

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