docbook-apps

  • 1.  transform td role to td class in HTML-output

    Posted 09-15-2020 10:26
    Hi everyone, I'm using the DocBook XSL to transform DocBook XML to EPUB and HTML. I would like to transform

    td role="breedte-50"

    to

    td class="breedte-50"

    in my HTML output, but unfortunately the output is

    td

    I have tried to use match:
    docbook:td[@role = 'bron']

    and I've tried the class.value mode. They both don't work.

    I've read two posts (from 2010 and 2011) that address this topic. Is there a way to add classes to td's?

    Thanks in advance,
    Kind regards,
    Michel





  • 2.  Re: [docbook-apps] transform td role to td class in HTML-output

    Posted 09-15-2020 12:21
    Hi, Michel! I have some templates that use class.mode in my
    customization. I can confirm that this XSL controls the class
    attribute in output HTML:

    <xsl:template match="d:preface[@role = 'apiPortalHome']" mode="class.value">
    <xsl:value-of select="'apiPortalHome'"/>
    </xsl:template>

    That template allows us to add some special CSS to a specific page in
    a doc set. I added the template based on the excellent coverage in
    http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#CustomClassValues.

    Can you share more about how you tried class.value? What was the result?

    Peter

    On Tue, Sep 15, 2020 at 6:26 AM Michel van den Burg <burg@coutinho.nl> wrote:
    >
    > Hi everyone, I'm using the DocBook XSL to transform DocBook XML to EPUB and HTML. I would like to transform
    >
    > td role="breedte-50"
    >
    > to
    >
    > td class="breedte-50"
    >
    > in my HTML output, but unfortunately the output is
    >
    > td
    >
    > I have tried to use match:
    > docbook:td[@role = 'bron']
    >
    > and I've tried the class.value mode. They both don't work.
    >
    > I've read two posts (from 2010 and 2011) that address this topic. Is there a way to add classes to td's?
    >
    > Thanks in advance,
    > Kind regards,
    > Michel
    >
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >



  • 3.  Re: [docbook-apps] transform td role to td class in HTML-output

    Posted 09-15-2020 16:25
    Actually, the "class.value" mode isn't used with DocBook tables using
    HTML table markup.  That's because such tables are pretty much passed
    through to the HTML output, minus any DocBook attributes.  The td
    element's attributes are instead processed in mode="htmlTableAtt".  In
    that mode, by default only HTML attributes are copied through.  If the
    DocBook content was then that class would appear
    in the output.  However, if you want to transform @role, that mode is
    applied to all the source attributes, so this should work:

    <xsl:template match="d:td/@role" mode="htmlTableAtt">
      <xsl:attribute name="class">
        <xsl:value-of select="."/>
      </xsl:attribute>
    </xsl:template>

    I really need to update my book with all the changes that have been made
    to DocBook XSL.

    Bob Stayton
    bobs@sagehill.net

    On 9/15/2020 5:21 AM, Peter Desjardins wrote:
    > Hi, Michel! I have some templates that use class.mode in my
    > customization. I can confirm that this XSL controls the class
    > attribute in output HTML:
    >
    > <xsl:template match="d:preface[@role = 'apiPortalHome']" mode="class.value">
    > <xsl:value-of select="'apiPortalHome'"/>
    > </xsl:template>
    >
    > That template allows us to add some special CSS to a specific page in
    > a doc set. I added the template based on the excellent coverage in
    > http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#CustomClassValues.
    >
    > Can you share more about how you tried class.value? What was the result?
    >
    > Peter
    >
    > On Tue, Sep 15, 2020 at 6:26 AM Michel van den Burg <burg@coutinho.nl> wrote:
    >> Hi everyone, I'm using the DocBook XSL to transform DocBook XML to EPUB and HTML. I would like to transform
    >>
    >> td role="breedte-50"
    >>
    >> to
    >>
    >> td class="breedte-50"
    >>
    >> in my HTML output, but unfortunately the output is
    >>
    >> td
    >>
    >> I have tried to use match:
    >> docbook:td[@role = 'bron']
    >>
    >> and I've tried the class.value mode. They both don't work.
    >>
    >> I've read two posts (from 2010 and 2011) that address this topic. Is there a way to add classes to td's?
    >>
    >> Thanks in advance,
    >> Kind regards,
    >> Michel
    >>
    >>
    >>
    >> ---------------------------------------------------------------------
    >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >>
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >



  • 4.  RE: [docbook-apps] transform td role to td class in HTML-output

    Posted 09-16-2020 13:25
    Hello Bob (and Peter),

    Your template did the trick! It's nice to know that tables are treated differently. Thanks for helping us out.

    Kind regards,

    Michel

    Van: Bob Stayton <bobs@sagehill.net>
    Verzonden: dinsdag 15 september 2020 18:25
    Aan: docbook-apps@lists.oasis-open.org
    Onderwerp: Re: [docbook-apps] transform td role to td class in HTML-output

    Actually, the "class.value" mode isn't used with DocBook tables using HTML table markup.  That's because such tables are pretty much passed through to the HTML output, minus any DocBook attributes.  The td element's attributes are instead processed in mode="htmlTableAtt".  In that mode, by default only HTML attributes are copied through.  If the DocBook content was then that class would appear in the output.  However, if you want to transform @role, that mode is applied to all the source attributes, so this should work:
    <xsl:template match="d:td/@role" mode="htmlTableAtt">
      <xsl:attribute name="class">
        <xsl:value-of select="."/>
      </xsl:attribute>
    </xsl:template>
    I really need to update my book with all the changes that have been made to DocBook XSL.
    Bob Stayton
    mailto:bobs@sagehill.net
    On 9/15/2020 5:21 AM, Peter Desjardins wrote:
    Hi, Michel! I have some templates that use class.mode in my
    customization. I can confirm that this XSL controls the class
    attribute in output HTML:

    <xsl:template match="d:preface[@role = 'apiPortalHome']" mode="class.value">
    <xsl:value-of select="'apiPortalHome'"/>
    </xsl:template>

    That template allows us to add some special CSS to a specific page in
    a doc set. I added the template based on the excellent coverage in
    http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#CustomClassValues.

    Can you share more about how you tried class.value? What was the result?

    Peter

    On Tue, Sep 15, 2020 at 6:26 AM Michel van den Burg mailto:burg@coutinho.nl wrote:

    Hi everyone, I'm using the DocBook XSL to transform DocBook XML to EPUB and HTML. I would like to transform

    td role="breedte-50"

    to

    td class="breedte-50"

    in my HTML output, but unfortunately the output is

    td

    I have tried to use match:
    docbook:td[@role = 'bron']

    and I've tried the class.value mode. They both don't work.

    I've read two posts (from 2010 and 2011) that address this topic. Is there a way to add classes to td's?

    Thanks in advance,
    Kind regards,
    Michel



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: mailto:docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: mailto:docbook-apps-help@lists.oasis-open.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: mailto:docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: mailto:docbook-apps-help@lists.oasis-open.org