docbook-apps

Re: [docbook-apps] cross-book olinks in epub

  • 1.  Re: [docbook-apps] cross-book olinks in epub

    Posted 10-04-2011 14:55
    Hi Tim,
    You are correct that there is no syntax in Epub2 to link from one Epub to another.
    External linking for Epub3 is still under discussion and not included in the draft
    standard, as far as I can tell. The general solution is difficult because of
    uniqueness, file locations, etc.

    However, I think there is still at least one case where active external links can
    work. For example, if you build your guides for both HTML and Epub outputs, and put
    the HTML up on a website, then the Epub user guide could link to the website version
    of the admin guide. Many Epub readers can follow web links, either directly or by
    forking off a browser.

    This would require setting the baseuri of the "other" documents in the olink database
    to the appropriate "http://..." value for each book so web link syntax is output for
    those external links.


    With the current epub stylesheets, a customization can turn off the active link while
    still rendering the text from the olink database. The template named 'make.olink.href'
    in common/olink.xsl handles forming the href string for each olink. If the olink
    resolves in the database but that template returns a blank, then just the olink text
    is output without a hot link.

    If you use olinks only for external linking, then just making that an empty template
    would do the job. However, if you use olinks for both internal links among modular
    docs and for external links, then a more detailed customization is needed to preserve
    the internal hot links. Your customization would need to compare the value of
    'current.docid' to the targetdoc value of the olink, and return blank only if they
    differ, otherwise return the href from the database.

    I think selecting this behavior with a new stylesheet param for the epub stylesheets
    would be a good new feature. In fact, it should probably be the default behavior, as
    the website setup I described is a special case.

    I think you would want to set the stylesheet param 'olink.doctitle' to 'yes' so that
    external olink text includes a reference to the other book's title, otherwise readers
    would not have enough context to interpret "Table 3.1".


    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net


    ----- Original Message -----
    From: "Tim Arnold" <jtim.arnold@gmail.com>
    To: <docbook-apps@lists.oasis-open.org>
    Sent: Monday, October 03, 2011 11:53 AM
    Subject: [docbook-apps] cross-book olinks in epub


    > hi,
    > I'm using xsltproc with the 1.76.1 epub/docbook.xsl stylesheets. When
    > creating a standalone epub doc, I get real hyperlinks for
    > cross-document links.
    >
    > For example, see this page from the DocBook XSL Guide:
    > http://www.sagehill.net/docbookxsl/Olinking.html
    >
    > Suppose you create an epub of the userguide; I believe it should not
    > contain active hyperlinks to the admin guide.
    > I think that such cross-document references should resolve as text-only.
    > That is, a hyperlink that goes to an external docset should not be
    > created for epub.
    >
    > That is just my opinion, I haven't read the official spec. But it
    > seems unusable for an epub to retain relative links to an external
    > document.
    > Does that make sense? Am I misunderstanding?
    >
    > thanks,
    > --Tim Arnold
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >
    >