What's the content in the NCX relative to?

3 posts / 0 new
Last post

According to the OPF specification at http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.3

"Each item element contained within a manifest element must have the attributes id, href (a URI; if relative, the URI is interpreted as relative to the OPF Package Document file containing the reference), and media-type (specifying the item’s MIME media type)."

So, it's clearly stated that the URIs of the items in the manifest are relative to the URI of the OPF document itself.

What about the NCX? Are the URIs of the content relative to the NCX file (as expected)? I couldn't find this defined in the spec. It's true that most often the NCX and the OPF are in the same folder, but I didn't see such a requirement either, so one or the other needs to be specified. Of course, it might as well be me who's missing something :-)

Thanks very much!

You have to go hunting into the OCF 2 specification to get the answer:

Files within the Abstract Container reference each other via Relative IRI References (http://www.ietf.org/rfc/rfc3987.txt and http://www.ietf.org/rfc/rfc3986.txt), no matter what is used for the physical container (e.g., File System Container or ZIP Container) ... For Relative IRI References, the Base IRI (see RFC3986) is determined by the relevant language specifications for the given file formats.

So, yes, relative to the file's location in the container is right. It's probably not made explicit in the OPF specification because it's simply adapting a DAISY technology. (But, oddly, the DAISY specification appears to be silent on relative IRIs or how to resolve the base IRI, at least that I can see.)

Thanks very much Matt! I didn't expect an answer so soon, highly appreciate your help. :-)

Cheers!

Secondary menu