Re: Getting a mapping between id's and output files
Bob Stayton <[email protected]> Tue, 15 Nov 2022 17:41:54 -0800
| Newsgroups | gmane.text.docbook.apps |
|---|---|
| Message-ID | <[email protected]> |
--------------vH5jp0JiW4RI063ojEnQOP8o
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
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
--------------vH5jp0JiW4RI063ojEnQOP8o
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><font size="2"><font face="Helvetica, Arial, sans-serif">Hi Tom,</font></font></p>
<p><font size="2"><font face="Helvetica, Arial, sans-serif">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.<br>
</font></font></p>
<p><font size="2"><font face="Helvetica, Arial, sans-serif">Your app
could open that file, or you could further process it with a
simple stylesheet to refine it. <br>
</font></font></p>
<p><font size="2"><font face="Helvetica, Arial, sans-serif">Check
out this chapter in my book on olinking:</font></font></p>
<p><font size="2"><font face="Helvetica, Arial, sans-serif"><a class="moz-txt-link-freetext" href="http://www.sagehill.net/docbookxsl/Olinking.html">http://www.sagehill.net/docbookxsl/Olinking.html</a></font></font></p>
<p><font size="2"><font face="Helvetica, Arial, sans-serif">Bob</font></font><br>
</p>
<div class="moz-cite-prefix">On 11/15/2022 3:49 PM, Tom Moore wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CANwy9RQEyZv9JEogOZu5YNpO-e=LorrptTk_TZK_5=WoZOTPew@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Hi all</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.<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. 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.<br>
</div>
<div><br>
</div>
<div>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?<br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Tom<br>
</div>
</div>
</blockquote>
</body>
</html>
--------------vH5jp0JiW4RI063ojEnQOP8o--