List Info

Thread: QandASet encapsulation and TOC




QandASet encapsulation and TOC
user name
2006-05-02 07:27:55
Thanks, I will try to find the mentioned thread. I have a feeling that all the Q&A-related elements loosely fit the rest of Docbook or they are just a bit overlooked as rarely used.

Regards,

-Zbyszek

On 5/1/06, Bob Stayton <sagehill.net">bobssagehill.net> wrote:
Hi,
As others have found, qandaset isn't really a structural element in DocBook.&nbsp; The highest level element in can be a child of is one of appendix, article, chapter, partintro, or preface.&nbsp; It is possible through customization to add qandasets to various tables of contents, as was described in an earlier thread, but you would have to handle the nested qandaset hierarchy yourself.
 
I don't know if this would work in your case, but a solution that has been suggested before for large structured FAQs is to use sections to form the structure, and make each qandset within a section a simple list. ; The qandaset would have no title; instead, the title would go on the section.&nbsp; That way you can more easily get your groups into a TOC, and it would be able to be handled in a modular fashion without a lot of customization.
 
 
----- Original Message -----
Sent: Sunday, April 30, 2006 1:39 AM
Subject: [docbook-apps] QandASet encapsulation and TOC

Hi list,

My intent is to include a QandASet in a book. The qandaset, as it will grow, will later be excluded and published as a separate book(?). My question is: what kind of root element do you use to encapsulate qandaset in a book? Chapter, appendix? I have tried both and had a problem with TOC. While my customization layer forces TOC to be present at the beginning of each chapter, it did not work for the one containing a qandaset divided into qandadivs. How can I insert a local TOC in such a case?

If qandaset is a separate document, what shall I use to encapsulate it to look similarly to a book but, of course, with title labeling specific to QandASets? I haven't found too much on qandaset in Docbook: TDG nor Docbook XSL (BTW, it's a great book).

Thanks,

-Zbyszek

QandASet encapsulation and TOC
user name
2006-05-04 13:42:29
Hello all,

I've had to play around with Q&As in html, so here is
my modest 
contribution to TOCs (Disclaimer: I'm a newbie). I have
just written the 
  missing templates for qand*

I have the following hierarchy : 
appendix/qandaset/qandadiv/qandaentry/question|answer

I never have titles in qandasets, which are only there as
markers, so 
the qandaset are skipped in the first node selection (see
first 
template). That should be easy enough to change (similar to
qandadiv).

The important part is that ALL qandaentries are skipped, to
be replacd 
by the question they wrap.

Here are my templates:

<!-- - - - - - - - - - - - - -  - - - - - - - - - - - - -
- - - - -->
<!--         Inserting qandasets and qandadivs in TOC    
        -->
<!-- - - - - -  - - - - - - - - - - - - - - - - - - - - -
- - - - -->

<!-- I've only changed the nodes to contain qandaset
-->
<xsl:template
match="preface|chapter|appendix|article"
mode="toc">
   <xsl:param name="toc-context"
select="."/>
   <xsl:variable name="nodes"
select="section|sect1
                                         
|simplesect[$simplesect.in.toc 
!= 0]
                                         
|refentry|qandaset/qandadiv
                                         
|glossary|bibliography|index
                                         
|bridgehead[$bridgehead.in.toc 
!= 0]"/>
   <xsl:call-template name="subtoc">
     <xsl:with-param name="toc-context"
select="$toc-context"/>
     <xsl:with-param name="nodes"
select="$nodes"/>
   </xsl:call-template>
</xsl:template>

<!-- A div copies its own name, and skips the qandaentry
to go on to the 
question. -->
<xsl:template match="qandadiv"
mode="toc">
   <xsl:call-template name="subtoc">
     <xsl:with-param name="toc-context"
select="."/>
     <xsl:with-param name="nodes"
select="qandadiv|qandaentry/question"/>
   </xsl:call-template>
</xsl:template>

<xsl:template match="question"
mode="titleabbrev.markup"><xsl:copy-of 
select="."/></xsl:template>

<!-- Copy of the
"figure|table|example|equation|procedure"
mode="toc" 
template in autotoc.xsl> -->
<xsl:template match="question"
mode="toc">
   <xsl:param name="toc-context"
select="."/>
   <xsl:element
name="{$toc.listitem.type}">
     <xsl:variable name="label">
       <xsl:apply-templates select="."
mode="label.markup"/>
     </xsl:variable>
     <xsl:copy-of select="$label"/>
     <xsl:if test="$label != ''">
       <xsl:value-of
select="$autotoc.label.separator"/>
     </xsl:if>
     <a>
       <xsl:attribute name="href">
         <xsl:call-template
name="href.target"/>
       </xsl:attribute>
       <xsl:apply-templates select="."
mode="titleabbrev.markup"/>
     </a>
   </xsl:element>
</xsl:template>


Zbyszek Cybulski wrote:
> Thanks, I will try to find the mentioned thread. I have
a feeling that 
> all the Q&A-related elements loosely fit the rest
of Docbook or they are 
> just a bit overlooked as rarely used.
> 
> Regards,
> 
> -Zbyszek
> 
> On 5/1/06, *Bob Stayton* <bobssagehill.net
<mailto:bobssagehill.net>> 
> wrote:
> 
>     Hi,
>     As others have found, qandaset isn't really a
structural element in
>     DocBook.  The highest level element in can be a
child of is one of
>     appendix, article, chapter, partintro, or preface. 
It is possible
>     through customization to add qandasets to various
tables of
>     contents, as was described in an earlier thread,
but you would have
>     to handle the nested qandaset hierarchy yourself.
>      
>     I don't know if this would work in your case, but
a solution that
>     has been suggested before for large structured FAQs
is to use
>     sections to form the structure, and make each
qandset within a
>     section a simple list.  The qandaset would have no
title; instead,
>     the title would go on the section.  That way you
can more easily get
>     your groups into a TOC, and it would be able to be
handled in a
>     modular fashion without a lot of customization.
>      
>     Bob Stayton
>     Sagehill Enterprises
>     DocBook Consulting
>     bobssagehill.net <mailto:bobssagehill.net>
>      
>      
> 
>         ----- Original Message -----
>         *From Zbyszek
Cybulski <mailto:z.cybulskigmail.com>
>         *To DocBook
Apps <mailto:docbook-appslists.oasis-open.org>
>         *Sent Sunday,
April 30, 2006 1:39 AM
>         *Subject
[docbook-apps] QandASet encapsulation and TOC
> 
>         Hi list,
> 
>         My intent is to include a QandASet in a book.
The qandaset, as
>         it will grow, will later be excluded and
published as a separate
>         book(?). My question is: what kind of root
element do you use to
>         encapsulate qandaset in a book? Chapter,
appendix? I have tried
>         both and had a problem with TOC. While my
customization layer
>         forces TOC to be present at the beginning of
each chapter, it
>         did not work for the one containing a qandaset
divided into
>         qandadivs. How can I insert a local TOC in such
a case?
> 
>         If qandaset is a separate document, what shall
I use to
>         encapsulate it to look similarly to a book but,
of course, with
>         title labeling specific to QandASets? I
haven't found too much
>         on qandaset in Docbook: TDG nor Docbook XSL
(BTW, it's a great
>         book).
> 
>         Thanks,
> 
>         -Zbyszek
> 
> 


-- 
Igor Rosenberg
Research engineer, OASIS project, INRIA
http://www-sop.inria.fr/oasis/personnel/Igor.Rosenberg/

------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )