This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] Custom layer and Chunking problem
- From: "Bob Stayton" <bobs at sagehill dot net>
- To: "aldib" <aldib at fuurou dot org>, <docbook-apps at lists dot oasis-open dot org>
- Date: Fri, 19 Sep 2003 11:13:08 -0700
- Subject: Re: [docbook-apps] Custom layer and Chunking problem
- References: <20030919132902.24729.qmail@server262.com>
Regarding the loss of chunking for sections when you use your customization:
The customization of chunking got a bit more complex in version 1.61.x
when Norm refactored the way chunking templates are assembled
into a stylesheet. His solution enabled separate customization of
chunking behavior and styling behavior. But now you need two files
to customize chunking in order to keep import precedence straight.
In your customization, your section template has higher import precedence
and so it interferes with the templates that chunk sections.
This reference describes how to set up the two files for customizing
chunking
since version 1.61.x of the stylesheets:
http://www.sagehill.net/docbookxsl/ChunkingCustomization.html
Regarding using id as class attribute:
The stylesheets have a partial solution already. The
'generate.id.attributes' parameter,
when set to 1, will copy (or generate) an id attribute through to the HTML
<div> element for
some elements. Then your CSS stylesheet can use an #id selector on them.
Unfortunately, that parameter is only used for divisions up to but not
including
sections. So you could could see how it is added for chapter (see
html/component.xsl)
and add it for sections. Then you don't have to modify a lot of templates.
I realize this is different from your customization that
uses class. But in this case, you really are using unique IDs and should
use
the id attribute and id selectors. That way you can avoid an accidental
collision between a real class name and an id class name.
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
----- Original Message -----
From: "aldib" <aldib@fuurou.org>
To: <docbook-apps@lists.oasis-open.org>
Sent: Friday, September 19, 2003 1:29 PM
Subject: [docbook-apps] Custom layer and Chunking problem
Hi, I'm trying to write a CSS to apply to the HTML generated by the docbook
xslt. I want to be able to use ID classes for a finer grained control so I
wrote a customization layer that puts the id attribute of my docbook
elements into the class attribute of the HTML element. The layer looks like:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../docbook/docbook-xsl-1.62.0/html/chunk.xsl"/>
<xsl:template match="section">
<xsl:variable name="depth" select="count(ancestor::section)+1"/>
<xsl:element name="div">
<xsl:choose>
<xsl:when test="@id">
<xsl:attribute name="class"><xsl:value-of select="@id"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class"><xsl:value-of select="name(.)"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="language.attribute"/>
<xsl:call-template name="section.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc') and $depth <=
$generate.section.toc.level">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="section.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.chunk.footnotes"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
My problems are: 1. I want to apply the same principle to any docbook
elements, do i need to overwite every template? 2. When i use my layer, the
processor does not chunk the document anymore. At run time I pass:
saxon.extensions=1 use.extensions=1 draft.mode=no tablecolumns.extension=0
html.stylesheet=style.css to my Saxon 6.5.2 engine. Any help would be
greatly apreciated. Thanks Alessandro
To unsubscribe from this list, send a post to
docbook-apps-unsubscribe@lists.oasis-open.org.
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org.