[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: 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
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]