OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook-apps] html output has class attributes

hi Bob,
Thanks for that info. It is pretty interesting to see how the class attributes are handled. 
Your suggestion is working for me.

On Thu, Feb 20, 2014 at 12:29 PM, Bob Stayton <bobs@sagehill.net> wrote:
Hi Tim,
You can turn off many of the class attributes, but not all.  Many of the class attributes are generated by applying templates in mode="class.attribute" using this template from html/html.xsl:

<xsl:template match="*" mode="class.attribute">
  <xsl:param name="class" select="local-name(.)"/>
  <!-- permit customization of class attributes -->
  <!-- Use element name by default -->
  <xsl:variable name="class.value">
    <xsl:apply-templates select="." mode="class.value">
      <xsl:with-param name="class" select="$class"/>

  <xsl:if test="string-length(normalize-space($class.value)) != 0">
    <xsl:attribute name="class">
      <xsl:value-of select="$class.value"/>

As you can see, if $class.value is empty, then no class attribute is generated.  So in your customization, you should be able to do this to turn them off:

<xsl:template match="*" mode="class.value"/>

and then add templates in that mode as needed for the elements you want to have class attributes.

Unfortunately, this will not control all the class attributes because many are still hardcoded in the stylesheet at this point.  You should be able to control most of the major elements, though.

Bob Stayton
Sagehill Enterprises

On 2/20/2014 6:55 AM, Tim Arnold wrote:
hi, I would like to completely control the class attributes in the
generated html output.
I'm using the DocBook 1.78.1 stylesheets.
Here is an example of what I'm doing. My document (name=listtest.xml):

<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="prcc">
   <info><title>The Title</title></info>
         <para>one item</para>

The command:
xsltproc --stringparam css.decoration 0 /path/xsl-1.78.1/html/docbook.xsl

The output (snippet):
<ul class="itemizedlist" type="disc">
   <li class="listitem"><p>one item</p></li>

I don't want any of the class attributes in the output because I will
generate my own with a set of templates like this:
<xsl:template match="d:listitem[@remap='stmt']" mode="class.value">
   <xsl:value-of select="'stmt'" />

I can't figure out what I'm doing wrong. Is there a way to turn off the
class attributes?
--Tim Arnold

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]