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] | [Elist Home]


Subject: Re: DOCBOOK-APPS: how to recognize depth of section for CSS


On Fri, Dec 06, 2002 at 11:59:29AM +0100, ABX wrote:
> Whe I apply any of xhtml outputs from XSL 1.58 to the sections then they are
> outputed into file as
> 
>   <div class="section">....</div>
> 
> I want then apply intendation to this rendering with
> 
> div.section {
>   margin-left:20px;
> }
> 
> This cause that every next level section level has larger margin. It works
> nice. Now I want to customize it so margin would increase for sections at
> <h1>, <h2> and <h3> level but for <h4> and deeper it should be the same as for
> <h3>. I suppose I could do it using sect1, sect2, sect3... but there is a
> problem. We move content from time to time and change level of section. It
> could be hard to modify sect numbering each time we move content. Much usefull
> it could be if XSL templates could investigate section level and output it as:
> 
> <div class="section_1">
>   <h1>title1</h1>
>   <div class="section_2">
>     <h2>title2</h2>
>     <div class="section_3">
>       <h3>title3</h3>
>       <div class="section_4">
>         <h3>title4</h4>
>       </div>
>     </div>
>   </div>
> </div>
> 
> Any advice how to customize XSL for such output ?

Copy the template <xsl:template match="section" from
html/sections.xsl to your customization layer, and
change the top of it from:

<xsl:template match="section">
  <xsl:variable name="depth" select="count(ancestor::section)+1"/>

  <div class="{name(.)}">

to:

<xsl:template match="section">
  <xsl:variable name="depth" select="count(ancestor::section)+1"/>

  <div class="{name(.)}_{$depth}">

-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com


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


Powered by eList eXpress LLC