docbook-apps

  • 1.  olinking in webhelp

    Posted 10-24-2012 18:47
    I'm investigating the DocBook SourceForge bug report #3469357 that requests
    that webhelp support olinking. I set up two books with olinks and processed
    them with webhelp from docbook-xsl-1.77.1. The olinks did not work, but I
    was able to determine why.

    The basic problem is that the xhtml stylesheet that webhelp is based on
    makes it difficult to set up olinking. The webhelp stylesheet imports the
    xhtml/chunk.xsl stylesheet, which in turn imports the xhtml/docbook.xsl
    stylesheet. The latter has this xsl:output element:

    <xsl:output method="xml" encoding="UTF-8" indent="no"
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

    The hardcoded doctype attributes in this element cause all output files from
    the xhtml stylesheet to have a declaration. That includes when a
    target.db file is generated for olinks. Most olinkdb.xml database files use
    system entity references to pull in the target.db files, but system entities
    do not work when there is a DOCTYPE in the file. With Saxon, it is not
    possible to override the original xsl:output, and so it is not possible to
    turn off the DOCTYPE.

    The only workaround I've ever found for using olinks with xhtml is to
    replace the system entity references in olinkdb.xml with XIncludes. An
    XInclude will tolerate a DOCTYPE declaration in target.db. After a bit of
    wrangling, I managed to get the webhelp/build.xml file to configure XInclude
    processing when the webhelp stylesheet is applied, so that when the
    olinkdb.xml file is opened to process olinks, it can resolve the XIncludes
    in that file.

    That introduced a further complication, though. The xhtml DOCTYPE has a
    remote SYSTEM URL, which means the XInclude processor will try to open it.
    Since it is to the www.w3.org website, it is not fast when responding. To
    avoid the network fetch, you can set up an XML catalog file to redirect to a
    local copy of the DTD, so the webhelp/build.xml file would need to add
    catalog processing to the xslt process.

    Here is the kicker, though. I found that I could avoid all of these
    complications by changing xsl/webhelp.xsl to import xhtml5/chunk.xsl instead
    of xhtml/chunk.xsl. The xhtml5 version does not have a hardcoded DOCTYPE,
    so the target.db file does not get a declaration, so system
    entities can be used. With that change, olinks worked out of the box when
    the files are properly configured.

    Now I'm not sure how to proceed. It appears that the xhtml5 output works in
    the two browsers I tested, but I have not done extensive testing. The
    xhtml5 stylesheet provides support for videoobject and audioobject, which
    could be nice for help systems.

    An alternative to switching over to xhtml5 would be to modify webhelp's base
    stylesheet to work like the xhtml5 base stylesheet. That stylesheet sets up
    a replacement for xhtml/docbook.xsl that imports all the other xhtml modules
    but does *not* have the problematic <xsl:output> element. You can look at
    xhtml5/xhtml-docbook.xsl to see what I mean. That means webhelp would stick
    with xhtml instead of xhtml5.

    I would suggest that if we don't switch webhelp to xhtml5, that we add a
    webhelp5.xsl anyway, for those who want to generate webhelp based on HTML5
    so they can get video and audio working.

    Comments?

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net




  • 2.  Re: [docbook-apps] olinking in webhelp

    Posted 10-24-2012 18:58
    On 10/24/2012 01:47 PM, Bob Stayton wrote:

    Ah, the dreaded Saxon 6.5 DOCTYPE bug. When I set up a system to use
    olink previously I recall I hacked around it by having Ant remove the
    DOCTYPE as part of the build process (or maybe I used xinclude, I can't
    recall, I've used both tricks in different situations).

    Webhelp is based on the xhtml xsls because originally the indexer could
    only parse xml files. Quite some time ago however, Kasun added tagsoup
    into the mix so that it could accept html as well.

    > Now I'm not sure how to proceed. It appears that the xhtml5 output
    > works in the two browsers I tested, but I have not done extensive
    > testing. The xhtml5 stylesheet provides support for videoobject and
    > audioobject, which could be nice for help systems.

    Testing would be the only reason to hesitate. One reason I've liked
    xhtml with the doctype in the past is that it kept browsers out of
    quirks mode, but I don't keep up with the latest trends in browser
    behavior.

    > An alternative to switching over to xhtml5 would be to modify webhelp's
    > base stylesheet to work like the xhtml5 base stylesheet. That stylesheet
    > sets up a replacement for xhtml/docbook.xsl that imports all the other
    > xhtml modules but does *not* have the problematic <xsl:output> element.
    > You can look at xhtml5/xhtml-docbook.xsl to see what I mean. That means
    > webhelp would stick with xhtml instead of xhtml5.
    >
    > I would suggest that if we don't switch webhelp to xhtml5, that we add a
    > webhelp5.xsl anyway, for those who want to generate webhelp based on
    > HTML5 so they can get video and audio working.

    I don't have strong preferences. Switching base xsls could affect
    customization layers, but progress is good too.

    David




  • 3.  Re: [docbook-apps] olinking in webhelp

    Posted 10-25-2012 08:20
    On 24.10.2012 20:57, David Cramer wrote:

    > Testing would be the only reason to hesitate. One reason I've liked
    > xhtml with the doctype in the past is that it kept browsers out of
    > quirks mode, but I don't keep up with the latest trends in browser
    > behavior.

    XHTML5 stylesheets output which is enough for switching
    into standards mode.

    I have just checked output of XHTML5 stylesheet and there are some
    things which could be improved.

    XHTML is usually served with a wrong MIME type as text/html and web
    browsers then use HTML parser on content. In order to get encoding rigth
    XML declaration should be there but tag with encoding should be
    there.

    XML declaration can be easily omitted by omit-xml-declaration on
    xsl:output. The second thing is more tricky, but in Saxon 6.5 you can
    specify output method as saxon:xhtml and this does the job.

    At least for WebHelp which relies on Ant xhtml:saxon can be make defaut
    as Ant script invokes transformation as well.

    > I don't have strong preferences. Switching base xsls could affect
    > customization layers, but progress is good too.

    I think that WebHelp is still rather moving target, so things are likely
    to break. But sooner we will fix something it's better.

    Also yesterday I was consulting using WebHelp at client's site and
    discovered some really strange things. For example admon.graphics is
    only parameter supplied to transformation in Ant which makes it
    impossible to specify this parameter in customization layer. It took me
    quite a while to figure this out. Also there was some bug in Javascript
    code for handling links where chunk.section.depth was lower then 3 which
    is default in WebHelp.

    I hope I will get soon time to comment on few similar issues.

    Jirka

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    ------------------------------------------------------------------
    Professional XML consulting and training services
    DocBook customization, custom XSLT/XSL-FO document processing
    ------------------------------------------------------------------
    OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
    ------------------------------------------------------------------




  • 4.  Re: [docbook-apps] olinking in webhelp

    Posted 10-25-2012 16:22
    Hi Jirka,
    Thanks for the information about XHTML5. I'll get these improvements into
    the next release.

    Regarding the XML declaration, though, I was a little confused by your mail.
    You said:

    "In order to get encoding right
    XML declaration should be there but tag with encoding should be
    there.

    XML declaration can be easily omitted by omit-xml-declaration on
    xsl:output."

    Should the XML declaration be there or not?

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    --------------------------------------------------
    From: "Jirka Kosek" <jirka@kosek.cz>
    Sent: Thursday, October 25, 2012 1:19 AM
    To: "David Cramer" <david@thingbag.net>
    Cc: "Bob Stayton" <bobs@sagehill.net>; <kasunbg@gmail.com>; "DocBook Apps"
    <docbook-apps@lists.oasis-open.org>
    Subject: Re: [docbook-apps] olinking in webhelp

    On 24.10.2012 20:57, David Cramer wrote:

    > Testing would be the only reason to hesitate. One reason I've liked
    > xhtml with the doctype in the past is that it kept browsers out of
    > quirks mode, but I don't keep up with the latest trends in browser
    > behavior.

    XHTML5 stylesheets output which is enough for switching
    into standards mode.

    I have just checked output of XHTML5 stylesheet and there are some
    things which could be improved.

    XHTML is usually served with a wrong MIME type as text/html and web
    browsers then use HTML parser on content. In order to get encoding rigth
    XML declaration should be there but tag with encoding should be
    there.

    XML declaration can be easily omitted by omit-xml-declaration on
    xsl:output. The second thing is more tricky, but in Saxon 6.5 you can
    specify output method as saxon:xhtml and this does the job.

    At least for WebHelp which relies on Ant xhtml:saxon can be make defaut
    as Ant script invokes transformation as well.

    > I don't have strong preferences. Switching base xsls could affect
    > customization layers, but progress is good too.

    I think that WebHelp is still rather moving target, so things are likely
    to break. But sooner we will fix something it's better.

    Also yesterday I was consulting using WebHelp at client's site and
    discovered some really strange things. For example admon.graphics is
    only parameter supplied to transformation in Ant which makes it
    impossible to specify this parameter in customization layer. It took me
    quite a while to figure this out. Also there was some bug in Javascript
    code for handling links where chunk.section.depth was lower then 3 which
    is default in WebHelp.

    I hope I will get soon time to comment on few similar issues.

    Jirka






  • 5.  Re: [docbook-apps] olinking in webhelp

    Posted 10-25-2012 19:03
    On 25.10.2012 18:22, Bob Stayton wrote:

    > Regarding the XML declaration, though, I was a little confused by your
    > mail. You said:
    >
    > "In order to get encoding right
    > XML declaration should be there but tag with encoding should be
    > there.
    >
    > XML declaration can be easily omitted by omit-xml-declaration on
    > xsl:output."
    >
    > Should the XML declaration be there or not?

    It shouldn't be there, sorry I was typing slowly then thinking.

    Ideally XHTML output generated by stylesheets should conform to HTML
    Polyglot rules:

    http://www.w3.org/TR/html-polyglot/

    This will make sure that content is parsed correctly even when send with
    wrong MIME type (which is quite often).

    Jirka

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    ------------------------------------------------------------------
    Professional XML consulting and training services
    DocBook customization, custom XSLT/XSL-FO document processing
    ------------------------------------------------------------------
    OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
    ------------------------------------------------------------------




  • 6.  Re: [docbook-apps] olinking in webhelp

    Posted 10-25-2012 19:11
    OK, thanks.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    --------------------------------------------------
    From: "Jirka Kosek" <jirka@kosek.cz>
    Sent: Thursday, October 25, 2012 12:02 PM
    To: "Bob Stayton" <bobs@sagehill.net>
    Cc: "David Cramer" <david@thingbag.net>; <kasunbg@gmail.com>; "DocBook Apps"
    <docbook-apps@lists.oasis-open.org>
    Subject: Re: [docbook-apps] olinking in webhelp