0

Why are ePub content files, which (as I understand) are to be interpreted as XHTML, saved with a .html file extension? I realize that they are interpreted correctly by readers in accordance with their mime type (application/xhtml+xml) which is stored in the book's manifest. My question is why are they not given their correct file extension, so that if I were to double click the file it would be displayed appropriately as XHTML and not as HTML.

This ePub: The Metamorphosis, by Franz Kafka (Jackson Theme) is an example. Thanks

2
  • Why are epub .xhtml files saved as .html? – What exactly do you mean by are saved? By some app? It would help to describe your workflow a bit. If you mean by the PressBooks app, you could ask their devs. Apr 17, 2018 at 7:15
  • I think the xhtml extension is just optional and not mandatory for xhtml files (they are simply html coded according to XML standards). However, it is more common to use the extension inside ePubs. Apr 17, 2018 at 7:21

1 Answer 1

2

This appears to be a distinction between EPUB 2 and EPUB 3. EPUB 2 content files are expected to have .HTML extensions. EPUB 3 content files are expected to have .XHMTL extensions. The same book converted to both EPUB 2 and 3, passes as perfect with HTML extensions in EPUB 2, but does yield warnings (NOT errors, and still works) with HTML extensions for EPUB 3. Simply changing the extensions from HTML to XHTML, with the same internal file content, prevents the warnings.

Here's an example report on an EPUB 3 with HTML extensions from EPUB check:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.