docbook-apps

Re: [docbook-apps] Unresolved olink when generating target dababase

  • 1.  Re: [docbook-apps] Unresolved olink when generating target dababase

    Posted 03-16-2009 19:19
    Hi Jan,

    The error message appears during the collection process only because one of
    the elements whose text is being collected includes an olink. The term
    element in your varlistentry contains an olink.

    Here is what is going on.

    1. The olinks collection process includes every element that has an id
    attribute, on the assumption that someone may want to link to any id from
    another document. So when your varlistentry has an id, it is included in
    the target data. If it has no id, the varlistentry is not processed to
    collect its target data.

    2. When the varlistentry is processed to collect its target data, part of
    the data is the link text that would be generated if it were the target of
    an xref. Templates are applied to the term element to resolve the text to
    what it would be when output, and that text is saved in the target data
    element named <xreftext> in target.db.

    3. The first time the term element is processed for target text, the olink
    element is encountered, so the apply-templates processes the olink. But the
    first time through, the target.db data is not yet populated, and so the
    template with match="olink" cannot find a
    , and so it
    generates that error message.

    4. Since the olink did not resolve at that step, the xreftext for the
    varlistentry in the first pass does not have a resolved link, and so the
    collection process just outputs a around the olink's
    manually entered text. That's what you get when an olink does not resolve.

    5. The first collection process continues, and then finds the section with
    id="term" and adds that to the data collection. At the end, it writes out
    the target data that it has to target.db.

    6. The second time the target data is collected, again the varlistentry has
    an id so it is processed. At the start of the process, the target.db file
    is opened and loaded into memory. This time when the olink in the term is
    encountered, the target.db data has been populated from the previous run and
    has a div with targetptr="term", and so it generates a valid link in the
    xreftext. So that is why the second time the target data for varlistentry is
    instead of , and it does not generate
    the error message.

    So this situation comes up when an element that is included in the target
    data has an olink element it its text. The first time the data is
    collected, you will get that error message. As long as you collect the data
    first, and then run the processing to generate output, the olinks will
    resolve properly in the output.

    Let me know if any of this is not clear.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net