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] two toc:s in an article


Hi Fredrik,
I think the person who wrote the toc template did not imagine that both a manual and automatic toc would be used. If you want both, then you'll need to customize that template to change the logic. I changed the test attribute in the xsl:if statement:

<xsl:param name="process.source.toc" select="1"/>

<xsl:template match="d:chapter/d:toc | d:appendix/d:toc | d:preface/d:toc | d:article/d:toc">
 <xsl:variable name="toc.params">
   <xsl:call-template name="find.path.params">
     <xsl:with-param name="node" select="parent::*"/>
     <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
   </xsl:call-template>
 </xsl:variable>

 <!-- Do not output the toc element if one is already generated
      by the use of $generate.toc parameter, or if
      generating a source toc is turned off -->
 <xsl:if test="$process.source.toc != 0 or $process.empty.source.toc != 0">
   <xsl:choose>
     <xsl:when test="* and $process.source.toc != 0">
       <div>
         <xsl:apply-templates select="." mode="common.html.attributes"/>
         <xsl:call-template name="id.attribute"/>
         <xsl:apply-templates select="d:title"/>
         <dl>
           <xsl:apply-templates select="." mode="common.html.attributes"/>
           <xsl:apply-templates select="*[not(self::d:title)]"/>
         </dl>
       </div>
       <xsl:call-template name="component.toc.separator"/>
     </xsl:when>
     <xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
       <!-- trick to switch context node to section element -->
       <xsl:for-each select="parent::*">
         <xsl:call-template name="component.toc">
           <xsl:with-param name="toc.title.p"
                           select="contains($toc.params, 'title')"/>
         </xsl:call-template>
       </xsl:for-each>
       <xsl:call-template name="component.toc.separator"/>
     </xsl:when>
   </xsl:choose>
 </xsl:if>
</xsl:template>

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

--------------------------------------------------
From: "Fredrik Unger" <fred@tree.se>
Sent: Monday, January 28, 2013 4:38 AM
To: <docbook-apps@lists.oasis-open.org>
Subject: Re: [docbook-apps] two toc:s in an article

Hi,

The missing TOC can not be seen here :)
http://article.tree.se/server/
by using toc I hoped to get the styling of the toc on the page.
eg 2 tocs.

The #toc link in the text is generated from : <xref linkend="toc"/>
So the title is processed.

The xml I used to get a toc is below [1]. Some xref across documents would be better, as the title exist in the linked document.

On the other hand I use only the href name and not the full document
when linking as otherwise the language selection with apache would not work, and the target will be html after processing and not xml.


My own tool is : http://source.tree.se/treecutter/
It still needs some polish, and the documentation here needs an update.

It is basically a python application taking docbook articles in a
directory tree and builds a static website from them.

I picked <article> as it to me best fit the website model, fitting it to the html article tag. I know and used the docbook website package, but it was more cumbersome and this made it much easier for me to publish websites.

docbook is "cleaner" to write in than html... and I can generate nice pdfs. Menus are autogenerated from titles, and the resulting site is static. That was enough for my needs. I can also style it with normal html templates.

The tool works well with other sites and situations, I use
tree.se as a personal playground. Might open it up once
I have polished it enough.

/Fred


[1]
  <section>
    <title>Internet server book</title>
    <para>
      The book is currently not up to date. Some thing still applies
      but it will be rewritten in parts. The newest section
      Calenendarserver is up to date but not finished.
    </para>
  </section>
  <toc xml:id="toc">
    <title>Table of Contents</title>
<tocentry><link xlink:href="introduction">Introduction</link></tocentry>
    <tocdiv>
      <title>Encryption</title>
      <tocentry><link xlink:href="encryption">Encryption</link></tocentry>
      <tocentry><link xlink:href="certificate-authority">Certificate
      Authority</link></tocentry>
    </tocdiv>
    <tocdiv>
      <title>Service's</title>
<tocentry><link xlink:href="authentication">Authentication</link></tocentry>
      <tocentry><link xlink:href="webserver">Webserver</link></tocentry>
      <tocentry><link xlink:href="mailserver">Mailserver</link></tocentry>
      <tocentry><link xlink:href="ssh">sshserver</link></tocentry>
<tocentry><link xlink:href="calendarserver">Calendarserver</link></tocentry>
    </tocdiv>
  </toc>
</article>



On 01/25/2013 03:51 PM, Aaron DaMommio wrote:
Oh, I see what you mean now. I refer to those as local TOCs. I suppose
your choice of articles influences whether those are available, but
there is probably a way to automate what you are doing. Can you provide
more detail as to the markup you are using, and the results you want?
--Aaron

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org





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