No the code is general, nothing hard coded. The chap01ref refers to the id that should be on that spine entry in the opf (I just forgot to add it to the content.opf of the cfitest.epub).
Typically you walk the content.opf node tree to get the file to parse next via a redirect on the spine. But the content opf has already been parsed in the plugin interface code so all we need is the element number of the spine. 2 for the first entry, 4 for the second entry, etc (don't ask about why they are numbered that way!). An assert id in the content opf should generally fail in this case since I did not add the id, but will not since the stepnum takes us to the correct spine item.
This code should work for any epub as long as the epubcfis are correct for that epub.
So to create an epubcfi for the first file in this epub, you simply change the /6/4 at the beginning of the epubcfi and remove the assert, to be /6 (the spine) and say /2 which would be the first spine element.
Hope this helps,
Kevi
Quote:
Originally Posted by Doitsu
Hi KevinH,
This may be a stupid question. The epubcfis that you used all refer to chap01ref. For example:
Code:
epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/3:8)
However, the sample epub doesn't contain this id. Am I right in assuming that you hard-coded your example to only look in chapter01.xhtml?
If so, what part of the code do I need to change to select files with other spine ids?
D.
|