Re: Getting a mapping between id's and output files

Tom Moore <[email protected]> Wed, 16 Nov 2022 15:51:43 -0500
Newsgroups gmane.text.docbook.apps
Message-ID <CANwy9RS5Q4-qVwuL=axz72XM1kregWBbsJU54nu1GU6MOZK6QQ@mail.gmail.com>
--00000000000091d89205ed9ca438
Content-Type: text/plain; charset="UTF-8"

Well that is just brilliant and solves my problem 100%.  The target.db file
contains the information I need in an easily parsable format.  Thank you
very much for this advice.

Cheers,

Tom
P.S.   I just ordered a copy of your book.

On Tue, Nov 15, 2022 at 8:47 PM Bob Stayton <[email protected]> wrote:

> Hi Tom,
>
> You can generate something like what you need already using the olink
> mechanism.  If you set the stylesheet parameter 'collect.xref.targets' to a
> value of 'yes', then when you process your document for HTML output you
> will also generate a target.db file that is used in olinking (there's a
> parameter to rename that file).  It is an XML file that contains all
> potential cross reference targets for that document.  In that file, the
> <div> elements hold the info for the hierarchical elements, and <obj>
> elements contain the info for the nonhierarchical elements (tables,
> figures, etc.).  For each, its targetptr attribute contains the element's
> id, and its href attribute contains the link to that element in your output.
>
> Your app could open that file, or you could further process it with a
> simple stylesheet to refine it.
>
> Check out this chapter in my book on olinking:
>
> http://www.sagehill.net/docbookxsl/Olinking.html
>
> Bob
> On 11/15/2022 3:49 PM, Tom Moore wrote:
>
> Hi all
>
> I have a desktop app and I have written documentation for this app in
> DocBook.  I am producing webhelp and posting these html pages online.  From
> within my application I would like to be able to open pages from the online
> webhelp in a local browser.  All of this works nicely so far.
>
> The problem is knowing which page to open for a given topic.  To solve
> this problem I would like to produce a file that contains the mappings
> between all of the id attributes that are declared in my document and the
> name of the chunked html output file that contains the id.  Ideally the
> mapping would be to the chunk plus anchor if the element containing the id
> is not the outermost section, chapter, appendix, etc of the chunk.  Then
> from within my app I can look up the mapping for a given id, and request
> the browser to open the desired page.
>
> I expect that this is something that can be done using xslt technology,
> but I do not know where to begin.  I am at the skill level where I have
> made a few small customizations in a project that used xslt, but I don't
> really know how to go about opening a file and writing output, where to
> find the id value, where to find the chunk name, etc.   In other words a
> beginner looking at the start of a steep learning curve.
>
> Can someone point me in the right direction for this task?  I notice that
> the javahelp output creates a mapping file that is almost right, except
> that it does not use the chunk names derived from the <?dbhtml
> filename=""?> processing instructions, which I am using in order to get
> links that don't shift around as I add chapters and sections.  Is the
> javahelp tool a good starting point or would it be better to start from
> scratch?  Is there a book that you would recommend that is good to learn
> from?
>
> Thanks,
>
> Tom
>
>

--00000000000091d89205ed9ca438
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div>Well that is just brilliant and solv=
es my problem 100%.=C2=A0 The target.db file contains the information I nee=
d in an easily parsable format.=C2=A0 Thank you very much for this advice.<=
/div><div><br></div><div>Cheers,</div><div><br></div><div>Tom</div><div>P.S=
.=20
=C2=A0 I just ordered a copy of your book.

</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_=
attr">On Tue, Nov 15, 2022 at 8:47 PM Bob Stayton &lt;<a href=3D"mailto:bob=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">
 =20
   =20
 =20
  <div>
    <p><font size=3D"2"><font face=3D"Helvetica, Arial, sans-serif">Hi Tom,=
</font></font></p>
    <p><font size=3D"2"><font face=3D"Helvetica, Arial, sans-serif">You can
          generate something like what you need already using the olink
          mechanism.=C2=A0 If you set the stylesheet parameter
          &#39;collect.xref.targets&#39; to a value of &#39;yes&#39;, then =
when you
          process your document for HTML output you will also generate a
          target.db file that is used in olinking (there&#39;s a parameter
          to rename that file).=C2=A0 It is an XML file that contains all
          potential cross reference targets for that document.=C2=A0 In tha=
t
          file, the &lt;div&gt; elements hold the info for the
          hierarchical elements, and &lt;obj&gt; elements contain the
          info for the nonhierarchical elements (tables, figures,
          etc.).=C2=A0 For each, its targetptr attribute contains the
          element&#39;s id, and its href attribute contains the link to tha=
t
          element in your output.<br>
        </font></font></p>
    <p><font size=3D"2"><font face=3D"Helvetica, Arial, sans-serif">Your ap=
p
          could open that file, or you could further process it with a
          simple stylesheet to refine it. <br>
        </font></font></p>
    <p><font size=3D"2"><font face=3D"Helvetica, Arial, sans-serif">Check
          out this chapter in my book on olinking:</font></font></p>
    <p><font size=3D"2"><font face=3D"Helvetica, Arial, sans-serif"><a href=
=3D"http://www.sagehill.net/docbookxsl/Olinking.html" target=3D"_blank">htt=
p://www.sagehill.net/docbookxsl/Olinking.html</a></font></font></p>
    <p><font size=3D"2"><font face=3D"Helvetica, Arial, sans-serif">Bob</fo=
nt></font><br>
    </p>
    <div>On 11/15/2022 3:49 PM, Tom Moore wrote:<br>
    </div>
    <blockquote type=3D"cite">
     =20
      <div dir=3D"ltr">
        <div>Hi all</div>
        <div><br>
        </div>
        <div>I have a desktop app and I have written documentation for
          this app in DocBook.=C2=A0 I am producing webhelp and posting the=
se
          html pages online.=C2=A0 From within my application I would like =
to
          be able to open pages from the online webhelp in a local
          browser.=C2=A0 All of this works nicely so far.</div>
        <div><br>
        </div>
        <div>The problem is knowing which page to open for a given
          topic.=C2=A0 To solve this problem I would like to produce a file
          that contains the mappings between all of the id attributes
          that are declared in my document and the name of the chunked
          html output file that contains the id.=C2=A0 Ideally the mapping
          would be to the chunk plus anchor if the element containing
          the id is not the outermost section, chapter, appendix, etc of
          the chunk.=C2=A0 Then from within my app I can look up the mappin=
g
          for a given id, and request the browser to open the desired
          page.<br>
        </div>
        <div><br>
        </div>
        <div>I expect that this is something that can be done using xslt
          technology, but I do not know where to begin.=C2=A0 I am at the
          skill level where I have made a few small customizations in a
          project that used xslt, but I don&#39;t really know how to go
          about opening a file and writing output, where to find the id
          value, where to find the chunk name, etc.=C2=A0=C2=A0 In other wo=
rds a
          beginner looking at the start of a steep learning curve.<br>
        </div>
        <div><br>
        </div>
        <div>Can someone point me in the right direction for this task?=C2=
=A0
          I notice that the javahelp output creates a mapping file that
          is almost right, except that it does not use the chunk names
          derived from the &lt;?dbhtml filename=3D&quot;&quot;?&gt; process=
ing
          instructions, which I am using in order to get links that
          don&#39;t shift around as I add chapters and sections.=C2=A0 Is t=
he
          javahelp tool a good starting point or would it be better to
          start from scratch?=C2=A0 Is there a book that you would recommen=
d
          that is good to learn from?<br>
        </div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div><br>
        </div>
        <div>Tom<br>
        </div>
      </div>
    </blockquote>
  </div>

</blockquote></div></div>

--00000000000091d89205ed9ca438--