11-17-2013, 01:07 PM | #1 |
Member
Posts: 14
Karma: 10
Join Date: May 2011
Device: Kindle
|
Fragment identifiers
I am learning about the internals of the EPUB3 standard by writing my own transformation in XSLT2, using my thesis as an example text. Most of it is going excellently, but I am having some trouble understanding how the links between the toc.ncx and the documents are meant to work.
I am getting "ERROR: OEBPS/toc.ncx(25,47): 'd1e97': fragment identifier is not defined in 'OEBPS/index.xhtml'" (and others) from the online validator at ebookit.com for this: 21 <navPoint id="d1e97" playOrder="3"> 22 <navLabel> 23 <text>Dedication</text> 24 </navLabel> 25 <content src="index.xhtml#d1e97"/> 26 </navPoint> where index.xhtml says: <div class="dedication" id="d1e97"> <p>To xxxx, yyyy, zzzz for their patience and support. </p> </div> Given that you are not allowed by EPUB3 to use <a name="..."> (the ebookit validator marks all occurrences of that as an error), what is the mechanism for the resolution of these links? What is the fragment identifier in line 25 supposed to point at? if not a name attribute on an <a> element, or an ID? |
11-17-2013, 01:34 PM | #2 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
I don't know much about this, but it seems like you need full paths to files, or an indicator that is it relative to some other file.
|
Advert | |
|
11-23-2013, 06:06 PM | #3 |
Member
Posts: 14
Karma: 10
Join Date: May 2011
Device: Kindle
|
|
11-23-2013, 07:03 PM | #4 | |
Well trained by Cats
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
#foo1 says in the same file chapter1.html#foo1 says look in chapter1.html for foo1 The first case will get broken (in Sigils auto link rename) if the file splits from when the link was set the second survives, thus the suggestion to always use full names. it is more robust (and easier to track down if it does get broken) |
|
11-24-2013, 01:08 PM | #5 |
Grand Sorcerer
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I have no idea what the validator for ebookit.com is based on on, but I know the gist of what you've posted is perfectly valid. Make sure you use the IDPF's validator (http://validator.idpf.org/) to eliminate any possibility that ebookit.com's validator is the culprit.
I've validated several epub3 documents where the (x)html file and the toc.ncx file were in the same directory. Same basic "index.html#frag" pointing to an element with the id="frag" syntax. It should work fine, so there must be something else wrong. |
Advert | |
|
11-25-2013, 05:22 PM | #6 | |
Resident Curmudgeon
Posts: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
11-25-2013, 09:43 PM | #7 |
Grand Sorcerer
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
How on earth can you possibly deduce from the code snippets provided that the link from the TOC can just go "straight to the beginning of index.xhtml" ?
|
11-25-2013, 10:56 PM | #8 |
Resident Curmudgeon
Posts: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Because index.xhtml is a dedication page. Other then the XML code that's not being displayed, it's complete codewise.
|
11-26-2013, 05:23 AM | #9 |
Grand Sorcerer
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Why would you assume that index.xhtml is the dedication page only?
|
11-26-2013, 05:39 AM | #10 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
11-26-2013, 12:42 PM | #11 |
Grand Sorcerer
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
It still can still be included for various backward compatibility reasons. It will still pass the idpf's epubcheck with an ncx. But yeah, it's been replaced by the nav document.
|
03-28-2014, 05:13 PM | #12 |
Member
Posts: 14
Karma: 10
Join Date: May 2011
Device: Kindle
|
Just got back to this...thanks everyone for the suggestions. I had assumed (duh) that because the IDs have to be unique across the documents, just the fragment identifier without the filename would work. Add the filenames and it's fine. The reason for fragment identifiers even when going to the top of the file was that the "top" isn't actually where I wanted to send users, it was one element down (just a matter of alignment).
Now I have a single XSLT2 program to generate all the files, plus a little script that extracts all the image filenames from figures, and copies them all into the epub directory, then zips everything up and creates the .epub file. Now comes the task of testing in all the common readers, and making something that Calibre can open and translate reliably to all the formats. |
03-29-2014, 07:36 AM | #13 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
As you are doing your work, be aware that calibre's viewer is NOT guaranteed to display all possible varieties of epub3 and that if it does work, it may not in subsequent editions. It exists to support the other functions, not to serve as anybody's viewing platform.
|
03-29-2014, 01:56 PM | #14 | |
Member
Posts: 14
Karma: 10
Join Date: May 2011
Device: Kindle
|
Quote:
|
|
03-30-2014, 07:05 AM | #15 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
Unfortunately, it looks that will be required from now on. There was some attempt toward working to spec for epub2, but for epub3, the device manufacturers aren't even trying, with Apple and Kindle not complying with anything.
|
Tags |
fragment, identifier, ncx, toc |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fragment Identifier missing, but looks OK | flypig | ePub | 8 | 12-19-2018 06:58 PM |
FRAGMENT ERROR MESSAGE | dgbeig | ePub | 5 | 11-23-2013 07:21 PM |
Bulk edit of identifiers | rmagere | Library Management | 4 | 02-19-2012 04:10 AM |
Search on Identifiers Field | nynaevelan | Library Management | 2 | 01-25-2012 06:13 PM |
Modifying Identifiers | Fabe | Sigil | 6 | 01-11-2012 07:46 AM |