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]

XSL stylesheet for QandASet element.


Hello,

I have been modifying the DocBook XSL stylesheets (v1.15) to
cope with the 'qandaset' element for FO output. Let me first
signal that this is the first XSL that I've written. The
conversion of the qandaset could probably be done much better,
but my stylesheet gives me a basic Question and Answer list. I
have inspired myself by looking at the itemizedlist XSL
templates.

The restrictions that I see immediately are:

- No support for qandadiv.
- No translated strings "Question" and "Answer". 

Quick question: how do I retrieve the correct translated
strings? I looked in other files for examples, but could not
detect the mechanism. The strings "question" and "answer" are
already present in the stylesheets. 

BTW, any other remarks are ALWAYS welcome!

Ringo

=====
Ringo De Smet
Email @ home: Ringo.DeSmet@bigfoot.com
Email @ work: Ringo.DeSmet.atwork@bigfoot.com

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
                version='1.0'>

<!-- ********************************************************************
     $Id: qandaset.xsl,v 1.1 2000/06/22 11:03:47 nwalsh Exp $
     ********************************************************************

     This file is part of the XSL DocBook Stylesheet distribution.
     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
     and other information.

     ******************************************************************** -->

<xsl:variable name="qanda.defaultlabel">number</xsl:variable>
<xsl:variable name="generate.qandaset.toc" select="true()"/>
<xsl:variable name="generate.qandadiv.toc" select="false()"/>

<!-- ==================================================================== -->

<!-- FIXME: WRITE THIS! -->
<xsl:template match="qandaset">
  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
  <fo:list-block id="{$id}"
                 provisional-distance-between-starts="1in"
                 provisional-label-separation="0.25in"
                 space-before.minimum="0.8em"
                 space-before.optimum="1em"
                 space-before.maximum="1.2em">
    <xsl:apply-templates/>
  </fo:list-block>
</xsl:template>

<xsl:template match="qandaentry">
  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
  <fo:list-item id="{$id}"
                space-before.minimum="0.8em"
                space-before.optimum="1em"
                space-before.maximum="1.2em">
    <fo:list-item-label>
      <fo:block font-weight="bold">
        <xsl:text>Question:</xsl:text>
      </fo:block>
    </fo:list-item-label>
    <fo:list-item-body>
	<xsl:apply-templates select="question"/>
    </fo:list-item-body>
  </fo:list-item>
  <fo:list-item
                space-before.minimum="0.8em"
                space-before.optimum="1em"
                space-before.maximum="1.2em">
    <fo:list-item-label>
      <fo:block font-weight="bold">
        <xsl:text>Answer:</xsl:text>
      </fo:block>
    </fo:list-item-label>
    <fo:list-item-body>
	<xsl:apply-templates select="answer"/>
    </fo:list-item-body>
  </fo:list-item>
</xsl:template>

<xsl:template match="qandaentry/question">
  <fo:inline><xsl:apply-templates/></fo:inline>
</xsl:template>

<xsl:template match="qandaentry/answer">
  <fo:inline><xsl:apply-templates/></fo:inline>
</xsl:template>

</xsl:stylesheet>

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