This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Re: CSS-positioned TOC


Sam,

On Mon, 15 Nov 2004, Sam Steingold wrote:

> > * Michael Smith <fzvgu@kzy-qbp.bet> [2004-11-16 06:24:23 +0900]:
> >
> > Take a look at the following simple example:
> >
> >   http://docbook.sourceforge.net/css-example/
>
> this is nice, but not all pages have the TOC on the left.
> e.g., <http://docbook.sourceforge.net/css-example/c1s2.html>.
> it would be better if all of them did.
>

I have done something along those lines, where I embed Norms
stylesheets in my own layout. I modify the chunk-element-contents
template from chunk-common.xsl and then add a number of div's
e.g. header and navbar (read TOC). Most of Norms original page are
then embedded in an additional div,


The code that generate the navbar looks something, like this.

    <ul id="navSubMenu">
      <xsl:apply-templates select="$docroot//preface" mode="navElement"/>
      <xsl:apply-templates select="$docroot//chapter" mode="navElement"/>
      <xsl:if test="count($docroot//appendix)>0">
        <xsl:apply-templates select="$docroot//appendix" mode="navElement"/>
      </xsl:if>
    </ul>


<xsl:template match="preface|chapter|appendix" mode="navElement">
  <!-- write index for components (chapter/appendix) -->
  <xsl:variable name="uid">
    <xsl:value-of select="generate-id(.)"/>
  </xsl:variable>

  <li>
    <xsl:if test="name()='chapter'">
      <xsl:number count="chapter" format="1"/>
      <xsl:text> - </xsl:text>
    </xsl:if>
    <xsl:if test="name()='appendix'">
      <xsl:number count="appendix" format="A"/>
      <xsl:text> - </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="." mode="navElementRef"/>
  </li>
</xsl:template>


This is of course a bit primitive since I only have components in the
navigationsbar, but that is currently all I need, and it is simple and
it works (i.e. i will have a TOC on every page).


Regards,

Jens


> --
> Sam Steingold (http://www.podval.org/~sds) running w2k
> <http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
> <http://www.mideasttruth.com/> <http://www.honestreporting.com>
> Only adults have difficulty with child-proof caps.
>
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]