OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Subject: Re: DOCBOOK-APPS: link from HTML to docbook HTML

> From: klaas holwerda <kholwerd@xs4all.nl>
> I was wondering if there is a way to create links from HTML files to
> docbook generated HTML.
> I experimented with the DSSL style sheet, if i give a "id" to a section
> or chapter,
> most of the time i get file named like that.
> Which makes it easy to links to them from the outside, and even internal
> anchors do work.
> But in case of the first section within a chapter, the first section is
> placed on the same page as the chapter and
> its table of contents, so no seperate file.
> Therefore  next question would be how can i control that (certain)
> sections get placed on seperate pages.
> I tried <beginpage>, but that not make a difference.
> For the XML style sheets the behaviour is different, i get files like
> ch01.html , sect01.html etc.

> So i am wondering if i should forget about the idea, still
> i have a strong need for it :-(.

Don't give up.  There is a definite logic to the XSL
stylesheet output that lets you cross reference to the
HTML.  It works best when each element in the target
document has an id attribute.

If you are seeing ch01.html, etc., then the document you
are cross referencing to was chunked, meaning it was
split into many HTML files.  The breakpoints for chunking
are at the elements named <set>, <book>, <part>, <chapter>, <appendix>,
and sect1 (or first-level <section> equivalent).  And
a few others like <index>.  There is an XSL parameter
'chunk.sections' which if set to true will further break
up sect1 into more files.

If the element that starts a new chunk has an id attribute,
then that is used as the filename, plus ".html". If you
are seeing "ch01.html", then that chapter element did not
have an id value to make into a filename, so the XSL
stylesheet had to generate a name.  It does so by counting
chapters in the document. The naming scheme makes sure each
output filename is unique. If your document is a set of
books that each have a chapter 1, then the chunked
filenames use bk01ch01.html (book 1, chapter 1) and bk02ch01.html
(book2, chapter 1), etc.

So the filenames depend on how deeply the original
XML document was structured, and whether it
used id attributes in its chunking elements.

Every element that doesn't start a new chunk can still be
referenced if it has an id attribute, because the
stylesheet inserts <a name="id"> in the HTML output at that
point.  So if you know the ids of the chunk and of your
final destination, you can form an href like
HREF="myfile.html#finalstop".  If the target element
does not have an id, then there won't be an <a name="*" >
tag in the HTML output, so you can't reference it directly.

Working with filenames that are generated is risky, because
if the document is rearranged the numbering will
change.  That's why I said it works best if
all the elements you want have ids.  

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Powered by eList eXpress LLC