docbook-apps

  • 1.  [FILES] section of htmlhelp.hhp contains document text when htmlhelp.xsl is used with chunktoc.xsl

    Posted 03-15-2008 16:33
    Hi

    I try to use manually controlled chunking with htmlhelp output. I followed the instructions in Bob Stayton's book (maketoc.xsl -> chunktoc.xsl) and I got the html output chunked the way I wanted, but the [FILES] section of the generated htmlhelp.hhp contains plain document text (merged text nodes) instead of file names. If I manually fix the [FILES] section of htmlhelp.hhp I can compile the help project and I get the expected chm file.

    I would appreciate it if someone could confirm that this is an existing bug or someone could tell me if I am doing something wrong and help me to solve this problem.

    1. I have made this simple book for testing:


    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    <book id="book1">

    <chapter id="chap1">



    <para>para1.


    <para>para1_1</para>



    <para>para1_2</para>




    <para>para2</para>

    </chapter>
    </book>

    2. My TestBooktoc.xml contains this:
    <toc role="chunk-toc">
    <tocentry linkend="book1">
    <tocentry linkend="chap1">
    <tocentry linkend="chap1__sec1">
    </tocentry>
    <tocentry linkend="chap1__sec2">
    </tocentry>
    </tocentry>
    </tocentry>
    </toc>

    3. I replaced chunk.xsl with chunktoc.xsl in my htmlhelp.xsl so now it looks like this:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:import href="html/chunktoc.xsl"/>
    <xsl:include href="htmlhelp/htmlhelp-common.xsl"/>

    4. I run myhtmlhelp.xsl with the following parameters:
    chunk.section.depth=3
    chunk.toc=TestBooktoc.xml
    generate.section.toc.level=0
    generate.toc=book toc,figure
    htmlhelp.use.hhk=1
    saxon.character.representation=native;decimal
    use.id.as.filename=1 - It's not documented (at least I could not find any hint), but I had to realize that this does not work with chunktoc.xsl (maketoc.xsl also generates automatic file names).

    5. Running the stylesheet gives properly chunked html files with auto-generated filenames: ch01.htm, ch01s01.html, ch01s02.html.

    6. The generated htmlhelp.hhp file looks like this with document text in the [FILES] section:
    [OPTIONS]
    Binary TOC=Yes
    Compatibility=1.1 or later
    Compiled file=htmlhelp.chm
    Contents file=toc.hhc
    Default Window=Main
    Default topic=index.html
    Display compile progress=Yes
    Full-text search=Yes
    Language=0x0409 English (UNITED STATES)
    Title=Book
    Enhanced decompilation=No

    [WINDOWS]
    Main="Book","toc.hhc",,"index.html","index.html",,,,,0x2520,,0x703006,,,,,,,,0

    [FILES]
    BookChapter 1Section 1para1.Section 1_1para1_1Section 1_2para1_2Section 2para2

    If I use chunk.xsl instead of chunktoc.xsl the [FILES] section is generated properly. I guess that when I use chunktoc.xsl the <xsl:apply-templates select="/" mode="enumerate-files"/> instruction in htmlhelp-common.xsl does not find matching template rule to generate the [FILES] section so it simply copies all text nodes to the output.

    I use 1.73.1 version of the XSL Stylesheets and Saxon 6.5.

    Regards
    Tamas




  • 2.  Re: [docbook-apps] [FILES] section of htmlhelp.hhp contains document text when htmlhelp.xsl is used with chunktoc.xsl

    Posted 03-18-2008 15:46
    I think the problem is that the htmlhelp templates that generate the extra
    project files are not written to use the chunk.toc parameter properly, and
    so the project files are mangled. I think that feature only works with
    straight html and xhtml chunked output. It is a deficiency that should be
    corrected, but I don't see any easy workaround from here. You might file a
    bug report on the SourceForge site.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net





  • 3.  Re: [docbook-apps] [FILES] section of htmlhelp.hhp contains document text when htmlhelp.xsl is used with chunktoc.xsl

    Posted 03-19-2008 16:38
    Bob

    Thanks for your reply. I had time to look at this problem again yesterday and as I see the problem is that chunktoc.xsl does not load chunk-code.xsl where all the templates with mode="enumerate-files" are defined. Putting <xsl:include href="chunk-code.xsl"/> into chunktoc.xsl resulted in lots of Ambiguous template rule warnings. So instead of loading chunk-code.xsl I simply copied all templates with mode="enumerate-files" from chunk-code.xsl to chunktoc.xsl and that solved the problem for now. I think the right solution would be to move these templates to a separate stylesheet and include that stylesheet in both chunktoc.xsl and chunk.xsl. Anyway I will file a bug report on the SourceForge site.

    Regards
    Tamas



    Bob Stayton <bobs@sagehill.net> írta:

    I think the problem is that the htmlhelp templates that generate the extra
    project files are not written to use the chunk.toc parameter properly, and
    so the project files are mangled. I think that feature only works with
    straight html and xhtml chunked output. It is a deficiency that should be
    corrected, but I don't see any easy workaround from here. You might file a
    bug report on the SourceForge site.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net