Re: transform td role to td class in HTML-output

Bob Stayton <[email protected]> Tue, 15 Sep 2020 09:24:41 -0700
Newsgroups gmane.text.docbook.apps
Message-ID <[email protected]>
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 <td class="breedte-50"> 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
[email protected]

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 <[email protected]> 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: [email protected]
>> For additional commands, e-mail: [email protected]
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>