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] qanda and answers in the appendix


Hi,
I think this approach of generating an intermediate file is fine, since you
want to create an appendix.  Generally I have found that when you need to
generate a structural element that is numbered, that trying to do it in one
pass is difficult because some docbook templates count elements in the
source file and miss the generated element.

I'll mention one method that you might want to investigate and use
in this situation, and that is processing elements using a mode.
By using a mode, you can process an element in a different way
from the default unnamed mode.  In this case, you can process
a qandaset in the default mode to remove it from its original
location, and create a new mode to generate it in your appendix.

Regarding your specific questions, I'm not quite clear on what the end
result should be.  Can you provide a short example of what you
want in the generated appendix?

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- 
From: "Emma Jane Hogbin" <emma@hicktech.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Friday, January 16, 2009 5:47 PM
Subject: [docbook-apps] qanda and answers in the appendix


> Hello,
>
> I've been trying to figure out how to create a book that has the answers
> from qanda at the back of the book in an appendix. I run two sets of
> transformations. One to build a qanda XML file, and a second one to build
> the full book with this additional qanda XML file as an appendix. I've
> gotten part of the way there with the following XSLT style sheet, but I
> still have to edit the qanda XML file by hand to remove irrelevant
> information. It works-ish, but I'd like to understand how to do this sort
> of thing correctly.
>
> Right now the DocBook is set up as follows (very abbreviated, of course):
>
> <chapter>
> <title>Chapter title</title>
> <itemizedlist>Summary of what's to come</itemizedlist>
> <sect1>contents</sect1>
> <sect1>contents</sect1>
> ...
> <sect1 role="qanda">questions</sect1>
> </chapter>
>
> Using the style sheet below I still have to go through after the
> transformation and remove the <itemizedlist> by hand. The reason this
> content ISN'T in a <sect1> is because I want it to show up on the first
> page of the chapter. All <sect1>s have a page-break before, so to keep the
> content where I want it, I've removed the <sect1>s from the intro (this is
> probably really wrong, but it works). :)
>
> Here is the style sheet:
>
> <xsl:template match="sect1">
>    <xsl:if test="@role='qanda'">
>       <sect1><xsl:apply-templates/></sect1>
>    </xsl:if>
>    <xsl:if test="not(@role='questions')"></xsl:if>
> </xsl:template>
>
> <xsl:template match="node()|@*">
>     <xsl:copy>
>        <xsl:apply-templates select="@*|node()" />
>     </xsl:copy>
> </xsl:template>
>
> <xsl:template match="qandaset">
>    <xsl:apply-templates />
> </xsl:template>
>
> <xsl:template match="qandaentry">
>    <xsl:apply-templates />
> </xsl:template>
>
> <xsl:template match="question">
>    <formalpara><title>Question:</title>
>       <xsl:apply-templates />
>    </formalpara>
> </xsl:template>
>
> <xsl:template match="answer">
>    <formalpara><title>Answer:</title>
>       <xsl:apply-templates />
>    </formalpara>
> </xsl:template>
>
>
>
> (1) Would it be easier to strip out the chapter pre-ambles if I changed my
> DocBook? (How would I eliminate the line break on the front page of the
> chapter if I did change the markup to <sect1>?)
> (2) I'm not sure how to make the root element <appendix> in the qanda.xml
> file?
> (3) Am I going about this the wrong way? I tried searching for things
> like, "qanda answers end of book xsl docbook" and have found pages like
> <http://www.sagehill.net/docbookxsl/HideAnswers.html>; however, this only
> shows how to hide the answers, not how to compile them at the back of the
> book.
> (4) I would also like to know how to update the <title> for the qanda
> <sect1>s to include the chapter title. Right now I update this by hand as
> part of the editing process.
>
> I know I'm getting greedy with my questions, so I will stop there for now.
> :)
>
>
> Thanks for your insight in advance. Please feel free to point me at online
> resources if I've missed the basics somewhere along the way.
>
>
>
> regards,
> emma
>
>
> -- 
> Emma Jane Hogbin
> web. www.hicktech.com
>
> ---------------------------------------------------------------------
> 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]