docbook-apps

  • 1.  Website: Problem using olinks across websites

    Posted 04-01-2008 03:29
    I maintain a web site as a collection of DocBook websites, each with its
    own layout and its own TOC. I want to replace the old ulinks with
    olinks. The olinks are working fine within each website, but olinks
    across websites fail to resolve. Here's how TDG says to do it:

    "Once you have the targets database, you can pass its pathname to the
    XSLT processor using the target.database.document stylesheet parameter.
    This database is in addition to (and separate from) the olink database
    that resolves olinks between webpages in your website. The database of
    internal olinks is identified with the website.database.document
    parameter. When the processor encounters an olink, it first checks the
    website database before consulting the offsite database."

    All right, here's how I've been trying to implement it:

    1. In my ant script, after building the layouts, I transform each
    website in turn. In addition to setting collect.xref.targets='yes' and
    declaring the current docid, I specify both the website.database and
    target.database documents, like this:

    <target name="doWebsite.home">
    <java ...
    <arg line="collect.xref.targets='yes'" />
    <arg line="current.docid='homeSite'" />
    <arg line="target.database.document='olinksitemap'"/>
    <arg line="website.database.document='website.database.xml'" />
    </java>
    </target>

    It seems the

    2. Meanwhile, I've created olinksitemap by hand. It includes the
    website.database.document for each website, like this:

    <targetset>

    <document targetdoc="homeSite">
    <xi:include href="website.database.xml" />
    </document>

    <document targetdoc="scheduleSite">
    <xi:include href="schedule/website.database.xml" />
    </document>

    ...
    </targetset>

    3. Finally, the olinks themselves. I've tried a couple of forms. For
    example, here's an olink to a homeSite page from within a scheduleSite
    page:

    <olink targetdoc="about" targetptr="about"/>
    <olink targetdoc="homeSite" targetptr="about"/>

    The first is the recommended form where 'about' is the id of the
    webpage. It does not resolve at all. The second is the conventional
    (non-website) form, but seems doomed because there is no book or any
    document with the id "homeSite". Encouragingly, it finds the title - but
    alas, the wrong url:

    About this site

    fwiw, here's the corresponding code in the website database:

    <document targetdoc="about" baseuri="about.html">
    lang="en">
    <ttl>About this site</ttl>


    Am I anywhere near the right track, or completely off? Any working
    examples of cross-website olinks?

    TIA,
    Denis




  • 2.  Re: [docbook-apps] Website: Problem using olinks across websites

    Posted 04-03-2008 16:46
    Hi Denis,
    A couple of items may fix this:

    > <targetset>
    >
    > <document targetdoc="homeSite">
    > <xi:include href="website.database.xml" />
    > </document>
    >
    > <document targetdoc="scheduleSite">
    > <xi:include href="schedule/website.database.xml" />
    > </document>
    >


    It seems you are missing a sitemap element in your olinkdatabase.

    > 3. Finally, the olinks themselves. I've tried a couple of forms. For
    > example, here's an olink to a homeSite page from within a scheduleSite
    > page:
    >
    > <olink targetdoc="about" targetptr="about"/>
    > <olink targetdoc="homeSite" targetptr="about"/>
    >
    > The first is the recommended form where 'about' is the id of the webpage.
    > It does not resolve at all. The second is the conventional (non-website)
    > form, but seems doomed because there is no book or any document with the
    > id "homeSite". Encouragingly, it finds the title - but alas, the wrong
    > url:
    >
    > About this site

    The first is recommended when referencing a page within a single website.
    The second is for referencing outside of website to another document (in
    this case, another website). The targetdoc values are an olink feature that
    exists outside of any document id attributes. All that needs to match is a
    targetdoc value in an olink to a targetdoc value in a <document> element in
    a database.

    The second example is correct and does find the data, as you noticed, but
    gives the wrong URI. I think adding the sitemap should fix the path
    problem.

    One thing I'm not clear about is your website.database.xml file. It seems
    to have a document element with targetdoc attribute. But then you put that
    inside another document element with different targetdoc in olinkdatabase.
    The document element should not be nested. Normally the target data for a
    document generated by the stylesheet does not have a document element.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net