docbook-apps

Expand all | Collapse all

Re: [docbook-apps] DocBook epub3 beta 3 stylesheets available

  • 1.  Re: [docbook-apps] DocBook epub3 beta 3 stylesheets available

    Posted 10-04-2011 15:50
    Hi Jirka,
    I just tried changing the following template in template/titlepage.xsl:

    <xsl:template match="t:templates">
    <xsl:element name="xsl:stylesheet">

    <xsl:attribute name="xmlns">http://www.w3.org/1999/xhtml</xsl:attribute>

    and it seems to add

    xmlns="http://www.w3.org/1999/xhtml"

    in the right place. That seems too easy. I'm used to doing all kinds of contortions
    to get namespaces correct. But I guess in this case we are not actually handling a
    namespace.

    If it is that easy, then we could add a stylesheet parameter to
    template/titlepage.xsl to specify a default namespace, and conditionally add it if
    not blank. The customizer would have to know to set the param, but I think that
    would be ok.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net


    ----- Original Message -----
    From: "Bob Stayton" <bobs@sagehill.net>
    To: "Jirka Kosek" <jirka@kosek.cz>
    Cc: "DocBook Apps" <docbook-apps@lists.oasis-open.org>; "Adam Witwer"
    <adam@oreilly.com>
    Sent: Tuesday, October 04, 2011 8:38 AM
    Subject: Re: [docbook-apps] DocBook epub3 beta 3 stylesheets available


    > Hi Jirka,
    > I ran into this same problem when creating the beta epub3 stylesheets. I had to
    > add some templates for isbn, issn, and biblioid for epub metadata, so I needed to
    > include an updated titlepage.templates.xsl in the beta distribution. For the beta,
    > I admit I just edited it by hand after generating it so it would have that default
    > namespace and work in the beta. I presume you created a custom version from
    > template/titlepage.xsl, and that is where that namespace gets lost.
    >
    > I think perhaps we need separate template/titlepage.xsl files for the different
    > namespaced outputs. I haven't looked into it yet, but that would probably be
    > easier than trying to do it with one stylesheet and different namespaces. I'm not
    > sure how to do it, though.
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    >
    > ----- Original Message -----
    > From: "Jirka Kosek" <jirka@kosek.cz>
    > To: "Bob Stayton" <bobs@sagehill.net>
    > Cc: "DocBook Apps" <docbook-apps@lists.oasis-open.org>; "Adam Witwer"
    > <adam@oreilly.com>
    > Sent: Tuesday, October 04, 2011 6:58 AM
    > Subject: Re: [docbook-apps] DocBook epub3 beta 3 stylesheets available
    >
    > On 4.10.2011 15:16, Jirka Kosek wrote:
    >
    >> When I convert with calibre all headings (chapter, section, table, ...)
    >> are lost.
    >
    > OK, problem were in titlepage.templates.xsl file. This file was missing
    > xmlns="http://www.w3.org/1999/xhtml" and thus generated
    > xmlns=""...> in the middle of XHTML5 output which confused software.
    >
    > This is known problem for customization of XHTML titlepages as well. Do
    > we already have some solution for this? In past I have used brutal text
    > replace on resulting .xsl file to add default namespace declaration.
    > Might be existing template/titlepage.xsl should be customized to handle
    > this automatically.
    >
    > Jirka
    >




  • 2.  Change in titlepage mechanism (Re: [docbook-apps] DocBook epub3 beta 3 stylesheets available)

    Posted 10-04-2011 21:41
    On 4.10.2011 17:49, Bob Stayton wrote:

    > <xsl:template match="t:templates">
    > <xsl:element name="xsl:stylesheet">
    >
    > <xsl:attribute name="xmlns">http://www.w3.org/1999/xhtml</xsl:attribute>
    >
    > and it seems to add
    >
    > xmlns="http://www.w3.org/1999/xhtml"
    >
    > in the right place. That seems too easy. I'm used to doing all kinds
    > of contortions to get namespaces correct. But I guess in this case we
    > are not actually handling a namespace.

    Hi Bob,

    this should raise error as xmlns is not attribute in XPath data model.
    Saxon throws the following message:

    Recoverable error
    at xsl:attribute on line 78 of
    file:/e:/src/db/xsl/epub3/../template/titlepage.xsl:
    Invalid attribute name: xmlns

    and xmlns is ignored. Of course this is little bit edge case so other
    processors might give different results.

    > If it is that easy, then we could add a stylesheet parameter to
    > template/titlepage.xsl to specify a default namespace, and
    > conditionally add it if not blank. The customizer would have to know
    > to set the param, but I think that would be ok.

    I have added ns parameter to titlepage.xsl. It has to be set for FO and
    XHTML, but should be empty for HTML. I have used different means for
    setting namespace, but result seems ok. I have modified Makefiles as
    well. You can see it as revision 9112.

    We should warn users in release notes that when generating custom
    titlepage templates this additional parameter has to be set fo FO/XHTML.

    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
    ------------------------------------------------------------------