docbook-apps

Expand all | Collapse all

issue with 1.79.1 stylesheets and table id

  • 1.  issue with 1.79.1 stylesheets and table id

    Posted 02-16-2016 15:47
    I'm using the 1.79.1 html stylesheets with the following example document I
    get an "xml:id" attribute on the resulting html table.

    That attribute causes some problems for me further down the processing
    line. This didn't occur with the 1.78.1 stylesheets. I'm guessing that this
    is a bug?

    Here's the example:

    <chapter xnlns="http://docbook.org/ns/docbook" version="5.0" xml:id="test">
    <info></info>
    <para>



    My Table
    column 1column 2

    </para>
    </chapter>

    I get xml:id on the resulting html table, using this command line:

    xsltproc/path/to/docbook/xsl-1.79.1/html/docbook.xsl test.xml



    Table¦1.1.¦My Table







    When I change to the 1.78.1 stylesheets:

    xsltproc /path/to/docbook/xsl-1.78.1/html/docbook.xsl test.xml

    The output is okay:



    Table¦1.1.¦My Table





    column 1column 2




    Is there something I can do outside of postprocessing the html to omit that
    attribute?

    thanks,
    --Tim



  • 2.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-16-2016 17:13
    Hi Tim,
    Yes, this is a bug. In DocBook 5, HTML-coded tables were allowed to
    have attributes with HTML attribute names such as @onmouseover, and they
    were expected to be passed through to the HTML table output. To support
    such attributes, version 1.79.1 added a template that starts with this:


    <xsl:template mode="htmlTableAtt"
    match="@abbr
    | @align
    | @axis
    ...

    which copies those attributes through. Unfortunately, it mistakenly
    includes xml:id, which should not be there, because the id is output
    elsewhere.

    So the workaround for you is to add this to your customization layer:

    <xsl:template mode="htmlTableAtt" select="xml:id" />


    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 2/16/2016 7:47 AM, Tim Arnold wrote:
    > I'm using the 1.79.1 html stylesheets with the following example
    > document I get an "xml:id" attribute on the resulting html table.
    >
    > That attribute causes some problems for me further down the processing
    > line. This didn't occur with the 1.78.1 stylesheets. I'm guessing that
    > this is a bug?
    >
    > Here's the example:
    >
    > <chapter xnlns="http://docbook.org/ns/docbook" version="5.0" xml:id="test">
    > <info></info>
    > <para>
    >
    >
    >
    >
    My Table
    column 1column 2

    > </para>
    > </chapter>
    >
    > I get xml:id on the resulting html table, using this command line:
    >
    > xsltproc/path/to/docbook/xsl-1.79.1/html/docbook.xsl test.xml
    >
    >

    >
    >

    Table¦1.1.¦My Table


    >

    >

    >

    >
    >
    > When I change to the 1.78.1 stylesheets:
    >
    > xsltproc /path/to/docbook/xsl-1.78.1/html/docbook.xsl test.xml
    >
    > The output is okay:
    >
    >

    >
    >

    Table¦1.1.¦My Table


    >

    >
    >
    >
    column 1column 2

    >

    >

    >
    > Is there something I can do outside of postprocessing the html to omit
    > that attribute?
    >
    > thanks,
    > --Tim
    >



  • 3.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-16-2016 18:02
    hi Bob, thanks!
    I must still be doing something wrong since I keep getting that attribute.
    Here is my test.xsl customization layer:


    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

    <xsl:import href="/path/to/xsl-1.79.1/html/docbook.xsl"/>
    <xsl:template mode="htmlTableAtt" select="xml:id" />

    </xsl:stylesheet>

    any ideas on what I'm doing wrong?
    thanks,
    --Tim


    On Tue, Feb 16, 2016 at 12:12 PM, Bob Stayton <bobs@sagehill.net> wrote:

    > Hi Tim,
    > Yes, this is a bug. In DocBook 5, HTML-coded tables were allowed to have
    > attributes with HTML attribute names such as @onmouseover, and they were
    > expected to be passed through to the HTML table output. To support such
    > attributes, version 1.79.1 added a template that starts with this:
    >
    >
    > <xsl:template mode="htmlTableAtt"
    > match="@abbr
    > | @align
    > | @axis
    > ...
    >
    > which copies those attributes through. Unfortunately, it mistakenly
    > includes xml:id, which should not be there, because the id is output
    > elsewhere.
    >
    > So the workaround for you is to add this to your customization layer:
    >
    > <xsl:template mode="htmlTableAtt" select="xml:id" />
    >
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    > On 2/16/2016 7:47 AM, Tim Arnold wrote:
    >
    >> I'm using the 1.79.1 html stylesheets with the following example
    >> document I get an "xml:id" attribute on the resulting html table.
    >>
    >> That attribute causes some problems for me further down the processing
    >> line. This didn't occur with the 1.78.1 stylesheets. I'm guessing that
    >> this is a bug?
    >>
    >> Here's the example:
    >>
    >> <chapter xnlns="http://docbook.org/ns/docbook" version="5.0"
    >> xml:id="test">
    >> <info></info>
    >> <para>
    >>
    >>
    >>
    >>
    My Table
    column 1column 2

    >> </para>
    >> </chapter>
    >>
    >> I get xml:id on the resulting html table, using this command line:
    >>
    >> xsltproc/path/to/docbook/xsl-1.79.1/html/docbook.xsl test.xml
    >>
    >>

    >>
    >>

    Table¦1.1.¦My Table


    >>

    >>

    >>

    >>
    >>
    >> When I change to the 1.78.1 stylesheets:
    >>
    >> xsltproc /path/to/docbook/xsl-1.78.1/html/docbook.xsl test.xml
    >>
    >> The output is okay:
    >>
    >>

    >>
    >>

    Table¦1.1.¦My Table


    >>

    >>
    >>
    >>
    column 1column 2

    >>

    >>

    >>
    >> Is there something I can do outside of postprocessing the html to omit
    >> that attribute?
    >>
    >> thanks,
    >> --Tim
    >>
    >>



  • 4.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-16-2016 20:11
    Hi Tim,

    Am Dienstag, 16. Februar 2016, 13:02:21 schrieb Tim Arnold:
    > I must still be doing something wrong since I keep getting that attribute.
    > Here is my test.xsl customization layer:
    >
    >
    > <xsl:stylesheet
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > version="1.0">
    >
    > <xsl:import href="/path/to/xsl-1.79.1/html/docbook.xsl"/>
    > <xsl:template mode="htmlTableAtt" select="xml:id" />

    Haven't tested it, but I guess, in the select attribute you are missing the
    "@" symbol:

    <xsl:template mode="htmlTableAtt" select="@xml:id" />

    Otherwise you would select the _element_ id in the XML namespace (which is
    very likely it doesn't exist).

    Good luck!

    --
    Gruß/Regards
    Thomas Schraitle




  • 5.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-17-2016 00:36
    Thanks Thomas,
    That make sense--I wondered about that too, but even with that change, I
    still get the xml:id attribute.

    --Tim


    On Tue, Feb 16, 2016 at 3:11 PM, Thomas Schraitle <tom_schr@web.de> wrote:

    > Hi Tim,
    >
    > Am Dienstag, 16. Februar 2016, 13:02:21 schrieb Tim Arnold:
    > > I must still be doing something wrong since I keep getting that
    > attribute.
    > > Here is my test.xsl customization layer:
    > >
    > >
    > > <xsl:stylesheet
    > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > > version="1.0">
    > >
    > > <xsl:import href="/path/to/xsl-1.79.1/html/docbook.xsl"/>
    > > <xsl:template mode="htmlTableAtt" select="xml:id" />
    >
    > Haven't tested it, but I guess, in the select attribute you are missing the
    > "@" symbol:
    >
    > <xsl:template mode="htmlTableAtt" select="@xml:id" />
    >
    > Otherwise you would select the _element_ id in the XML namespace (which is
    > very likely it doesn't exist).
    >
    > Good luck!
    >
    > --
    > Gruß/Regards
    > Thomas Schraitle
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >



  • 6.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-17-2016 17:55
    With that correction, it works for me. Not sure why it isn't for you.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 2/16/2016 4:36 PM, Tim Arnold wrote:
    > Thanks Thomas,
    > That make sense--I wondered about that too, but even with that change, I
    > still get the xml:id attribute.
    >
    > --Tim
    >
    > On Tue, Feb 16, 2016 at 3:11 PM, Thomas Schraitle <tom_schr@web.de
    > <mailto:tom_schr@web.de>> wrote:
    >
    > Hi Tim,
    >
    > Am Dienstag, 16. Februar 2016, 13:02:21 schrieb Tim Arnold:
    > > I must still be doing something wrong since I keep getting that attribute.
    > > Here is my test.xsl customization layer:
    > >
    > >
    > > <xsl:stylesheet
    > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > > version="1.0">
    > >
    > > <xsl:import href="/path/to/xsl-1.79.1/html/docbook.xsl"/>
    > > <xsl:template mode="htmlTableAtt" select="xml:id" />
    >
    > Haven't tested it, but I guess, in the select attribute you are
    > missing the
    > "@" symbol:
    >
    > <xsl:template mode="htmlTableAtt" select="@xml:id" />
    >
    > Otherwise you would select the _element_ id in the XML namespace
    > (which is
    > very likely it doesn't exist).
    >
    > Good luck!
    >
    > --
    > Gruß/Regards
    > Thomas Schraitle
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail:
    > docbook-apps-unsubscribe@lists.oasis-open.org
    > <mailto:docbook-apps-unsubscribe@lists.oasis-open.org>
    > For additional commands, e-mail:
    > docbook-apps-help@lists.oasis-open.org
    > <mailto:docbook-apps-help@lists.oasis-open.org>
    >
    >



  • 7.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-17-2016 18:22
    Hi Bob, Thomas,
    I'm bewildered. In case I've got something wrong in my source or
    stylesheet, here is what I'm doing:
    The command: *xsltproc test.xsl test.xml*
    The result has **

    test.xml:
    *<chapter xnlns="http://docbook.org/ns/docbook
    <http://docbook.org/ns/docbook>" version="5.0" xml:id="test">*
    *<info></info>*
    * <para>*
    *
    *
    * *
    * *
    *
    My Table
    column 1column 2
    *
    * </para>*
    *</chapter>*

    test.xsl:
    **
    *<xsl:stylesheet*
    * xmlns:xsl="http://www.w3.org/1999/XSL/Transform
    <http://www.w3.org/1999/XSL/Transform>"*
    * version="1.0">*

    * <xsl:import href="/path/to/xsl-1.79.1/html/docbook.xsl"/>*
    * <xsl:template mode="htmlTableAtt" select="@xml:id"/>*

    *</xsl:stylesheet>*

    If that works for you then I'm not sure what to do. Maybe try a different
    xsl processor?
    thanks,
    --Tim


    On Wed, Feb 17, 2016 at 12:54 PM, Bob Stayton <bobs@sagehill.net> wrote:

    > With that correction, it works for me. Not sure why it isn't for you.
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    > On 2/16/2016 4:36 PM, Tim Arnold wrote:
    >
    >> Thanks Thomas,
    >> That make sense--I wondered about that too, but even with that change, I
    >> still get the xml:id attribute.
    >>
    >> --Tim
    >>
    >> On Tue, Feb 16, 2016 at 3:11 PM, Thomas Schraitle <tom_schr@web.de
    >> <mailto:tom_schr@web.de>> wrote:
    >>
    >> Hi Tim,
    >>
    >> Am Dienstag, 16. Februar 2016, 13:02:21 schrieb Tim Arnold:
    >> > I must still be doing something wrong since I keep getting that
    >> attribute.
    >> > Here is my test.xsl customization layer:
    >> >
    >> >
    >> > <xsl:stylesheet
    >> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >> > version="1.0">
    >> >
    >> > <xsl:import href="/path/to/xsl-1.79.1/html/docbook.xsl"/>
    >> > <xsl:template mode="htmlTableAtt" select="xml:id" />
    >>
    >> Haven't tested it, but I guess, in the select attribute you are
    >> missing the
    >> "@" symbol:
    >>
    >> <xsl:template mode="htmlTableAtt" select="@xml:id" />
    >>
    >> Otherwise you would select the _element_ id in the XML namespace
    >> (which is
    >> very likely it doesn't exist).
    >>
    >> Good luck!
    >>
    >> --
    >> Gruß/Regards
    >> Thomas Schraitle
    >>
    >>
    >> ---------------------------------------------------------------------
    >> To unsubscribe, e-mail:
    >> docbook-apps-unsubscribe@lists.oasis-open.org
    >> <mailto:docbook-apps-unsubscribe@lists.oasis-open.org>
    >> For additional commands, e-mail:
    >> docbook-apps-help@lists.oasis-open.org
    >> <mailto:docbook-apps-help@lists.oasis-open.org>
    >>
    >>
    >>



  • 8.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-17-2016 18:35
    Hi,
    I think what is happening here is that you have DocBook 5 document
    written in the DocBook namespace but are using the non-namespaced
    version of the stylesheet that is better matched to DocBook 4. When
    that happens, the stylesheet detects the namespace, and then converts
    the document to DocBook 4 before applying formatting templates. Part of
    that conversion is to change each instance of xml:id in the document to
    id, so that your new template does not match.

    The solution is to either switch to the namespaced version of the
    stylesheets (recommended for Docbook 5), or change the customized
    template to match="@id".

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 2/17/2016 10:22 AM, Tim Arnold wrote:
    > Hi Bob, Thomas,
    > I'm bewildered. In case I've got something wrong in my source or
    > stylesheet, here is what I'm doing:
    > The command: *xsltproc test.xsl test.xml*
    > The result has **
    >
    > test.xml:
    > *<chapter xnlns="http://docbook.org/ns/docbook" version="5.0"
    > xml:id="test">*
    > *<info></info>*
    > * <para>*
    > *
    *
    > * *
    > * *
    > *
    My Table
    column 1column 2
    *
    > * </para>*
    > *</chapter>*
    >
    > test.xsl:
    > **
    > *<xsl:stylesheet*
    > * xmlns:xsl="http://www.w3.org/1999/XSL/Transform"*
    > * version="1.0">*
    > *
    > *
    > * <xsl:import href="/path/to/xsl-1.79.1/html/docbook.xsl"/>*
    > * <xsl:template mode="htmlTableAtt" select="@xml:id"/>*
    > *
    > *
    > *</xsl:stylesheet>*
    > *
    > *
    > If that works for you then I'm not sure what to do. Maybe try a
    > different xsl processor?
    > thanks,
    > --Tim
    >
    >
    > On Wed, Feb 17, 2016 at 12:54 PM, Bob Stayton <bobs@sagehill.net
    > <mailto:bobs@sagehill.net>> wrote:
    >
    > With that correction, it works for me. Not sure why it isn't for you.
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net <mailto:bobs@sagehill.net>
    >
    > On 2/16/2016 4:36 PM, Tim Arnold wrote:
    >
    > Thanks Thomas,
    > That make sense--I wondered about that too, but even with that
    > change, I
    > still get the xml:id attribute.
    >
    > --Tim
    >
    > On Tue, Feb 16, 2016 at 3:11 PM, Thomas Schraitle
    > <tom_schr@web.de <mailto:tom_schr@web.de>
    > <mailto:tom_schr@web.de <mailto:tom_schr@web.de>>> wrote:
    >
    > Hi Tim,
    >
    > Am Dienstag, 16. Februar 2016, 13:02:21 schrieb Tim Arnold:
    > > I must still be doing something wrong since I keep
    > getting that attribute.
    > > Here is my test.xsl customization layer:
    > >
    > >
    > > <xsl:stylesheet
    > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > > version="1.0">
    > >
    > > <xsl:import href="/path/to/xsl-1.79.1/html/docbook.xsl"/>
    > > <xsl:template mode="htmlTableAtt" select="xml:id" />
    >
    > Haven't tested it, but I guess, in the select attribute you are
    > missing the
    > "@" symbol:
    >
    > <xsl:template mode="htmlTableAtt" select="@xml:id" />
    >
    > Otherwise you would select the _element_ id in the XML
    > namespace
    > (which is
    > very likely it doesn't exist).
    >
    > Good luck!
    >
    > --
    > Gruß/Regards
    > Thomas Schraitle
    >
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail:
    > docbook-apps-unsubscribe@lists.oasis-open.org
    > <mailto:docbook-apps-unsubscribe@lists.oasis-open.org>
    > <mailto:docbook-apps-unsubscribe@lists.oasis-open.org
    > <mailto:docbook-apps-unsubscribe@lists.oasis-open.org>>
    > For additional commands, e-mail:
    > docbook-apps-help@lists.oasis-open.org
    > <mailto:docbook-apps-help@lists.oasis-open.org>
    > <mailto:docbook-apps-help@lists.oasis-open.org
    > <mailto:docbook-apps-help@lists.oasis-open.org>>
    >
    >
    >



  • 9.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-17-2016 19:30
    I just noticed that I had a typo in the source xml (misspelled xmlns).

    I fixed that typo, downloaded docbook-xsl-ns-1.79.1 from sourceforge, and
    changed the xsl to point to the newly unzipped stylesheets. Confident that
    the typo was the issue, I converted again:

    <xsl:import
    href="/u/tiarno/downloads/docbook-xsl-ns-1.79.1/html/docbook.xsl"/>
    <xsl:template mode="htmlTableAtt" select="@xml:id"/>

    I still get
    I also tried the non namespaced stylesheet and I get
    Note: namesp. cut : stripped namespace before processing My
    Chapter

    The table still contains the id, but without the xml namespace (which I
    think is what would be expected).

    So, I'm sorry to be a pest, but I don't see how this is happening.
    Do you have a test case I can run?

    On Wed, Feb 17, 2016 at 1:34 PM, Bob Stayton <bobs@sagehill.net> wrote:

    > Hi,
    > I think what is happening here is that you have DocBook 5 document written
    > in the DocBook namespace but are using the non-namespaced version of the
    > stylesheet that is better matched to DocBook 4. When that happens, the
    > stylesheet detects the namespace, and then converts the document to DocBook
    > 4 before applying formatting templates. Part of that conversion is to
    > change each instance of xml:id in the document to id, so that your new
    > template does not match.
    >
    > The solution is to either switch to the namespaced version of the
    > stylesheets (recommended for Docbook 5), or change the customized template
    > to match="@id".
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    >



  • 10.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-17-2016 19:41
    Try this:

    <xsl:template mode="htmlTableAtt" select="@xml:id">
    <xsl:message>got here</xsl:message>
    </xsl:template>

    If you don't see the message when it runs, then the custom template
    isn't being used for some reason.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 2/17/2016 11:30 AM, Tim Arnold wrote:
    > <xsl:template mode="htmlTableAtt" select="@xml:id"/>
    >



  • 11.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-18-2016 14:10
    Hi,

    > <xsl:template mode="htmlTableAtt" select="@xml:id">
    > <xsl:message>got here</xsl:message>
    > </xsl:template>

    If it still does not work, try changing select to match:

    <xsl:template mode="htmlTableAtt" match="@xml:id">

    73, Mario




  • 12.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-18-2016 16:39
    Oops, yes, that should have been a match attribute.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 2/18/2016 6:09 AM, Mario Klebsch wrote:
    > Hi,
    >
    >> <xsl:template mode="htmlTableAtt" select="@xml:id">
    >> <xsl:message>got here</xsl:message>
    >> </xsl:template>
    >
    > If it still does not work, try changing select to match:
    >
    > <xsl:template mode="htmlTableAtt" match="@xml:id">
    >
    > 73, Mario
    >



  • 13.  Re: [docbook-apps] issue with 1.79.1 stylesheets and table id

    Posted 02-18-2016 17:43
    Yes Mario, Thanks! that was my problem and now everything is working again.

    Two notes for anyone interested in this problem:
    (1)
    xsltproc was silent and continued to process the file so beware!
    saxon655 complained and exited with the nice error message:
    xsl:template must have a a name or match attribute (or both)

    (2)
    That fix got rid of the xml:id attributes but when you're producing epub3,
    you still need to filter out the other attributes that get copied into the
    html (rules, frame, and so on).

    thanks again,
    --Tim



    On Thu, Feb 18, 2016 at 11:39 AM, Bob Stayton <bobs@sagehill.net> wrote:

    > Oops, yes, that should have been a match attribute.
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    > On 2/18/2016 6:09 AM, Mario Klebsch wrote:
    >
    >> Hi,
    >>
    >> <xsl:template mode="htmlTableAtt" select="@xml:id">
    >>> <xsl:message>got here</xsl:message>
    >>> </xsl:template>
    >>>
    >>
    >> If it still does not work, try changing select to match:
    >>
    >> <xsl:template mode="htmlTableAtt" match="@xml:id">
    >>
    >> 73, Mario
    >>
    >>
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >