View Single Post
Old 02-14-2010, 12:45 AM   #16
RootlessAgrarian
Enthusiast
RootlessAgrarian is on a distinguished road
 
RootlessAgrarian's Avatar
 
Posts: 48
Karma: 62
Join Date: Jan 2010
Device: HANLIN V3
A) you people are Wonderful. Bouquets and heartfelt thanks all around.

B) case-sensitive tags in XHTML/XML, doh! my bad. got too used to loose, case-insensitive HTML parsers.

C) after fixing (ahem) this little problem I tried again... and found a new problem.

Looks like Sigil wrote an incomplete metadata block? I get complaints about "Unfinished element" at line 9 of content.opf. I hadn't touched this file with vim afaik, only the content???.xhtml files further down in text/.

I consulted Ainsworth's guide to XHTML (my current favourite tutorial/ref) and found that the metadata block must include title, identifier, and language. Looks like "language" is missing from the block in my content.opf, so I am adding Ainsworth's sample "en" language element.

<dc:language xsi:type="dcterms:RFC3066">en</dc:language>

this didn't fly either.

ERROR: AgCiv.epub/OEBPS/content.opf(8): The prefix "xsi" for attribute "xsi:type" associated with an element type "dc:language" is not bound.

(sigh) I get rid of the offending xsi:type syntax. finally, my epub is valid!

I now restart Sigil (drum roll...) and load the freshly validated epub. Yes, it loads! Yes, I can see the entire document. And best of all, YES it has a table of contents.

Now I'm going to Save it back and see if Sigil (a) writes a correct metadata block and (b) writes toc.ncx...

... and the answer is... Yes, the language tag has persisted in the metadata block, and Yes, toc.ncx is now fully populated with (I trust) correct section/subsection references.

I am, as far as I know, one happy camper and no longer *quite* such a n00b.

So why was the language element missing from the metadata block? Did Sigil leave it out? Did Calibre leave it out and Sigil simply replicate the bad block? Or have I been into that file with vim, accidentally deleting one line and subsequently forgetting all about it? I guess I'll find out next time I convert pdf to epub in Calibre and then export it for edit :-)

RootlessAgrarian is offline   Reply With Quote