home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / xml / gnome / xslt / docbook / html / db2html-qanda.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2009-03-17  |  5.1 KB  |  157 lines

  1. <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
  2. <!--
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU Lesser General Public License as published by the Free
  5. Software Foundation; either version 2 of the License, or (at your option) any
  6. later version.
  7.  
  8. This program is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  11. details.
  12.  
  13. You should have received a copy of the GNU Lesser General Public License
  14. along with this program; see the file COPYING.LGPL.  If not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. 02111-1307, USA.
  17. -->
  18.  
  19. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  20.                 xmlns="http://www.w3.org/1999/xhtml"
  21.                 version="1.0">
  22.  
  23. <!--!!==========================================================================
  24. DocBook to HTML - Question and Answer Sets
  25. :Requires: db-chunk db-label db2html-division gettext
  26.  
  27. REMARK: Describe this module
  28. -->
  29.  
  30.  
  31. <!--**==========================================================================
  32. db2html.qanda.css
  33. Outputs CSS that controls the appearance of question and answer elements
  34.  
  35. REMARK: Describe this template
  36. -->
  37. <xsl:template name="db2html.qanda.css">
  38. <xsl:text>
  39. dt.question { margin-left: 0em; }
  40. dt.question div.label { float: left; }
  41. dd + dt.question { margin-top: 1em; }
  42. dd.answer {
  43.   margin-top: 1em;
  44.   margin-left: 2em;
  45.   margin-right: 1em;
  46. }
  47. dd.answer div.label { float: left; }
  48. </xsl:text>
  49. </xsl:template>
  50.  
  51.  
  52. <!-- == Matched Templates == -->
  53.  
  54. <!-- = answer = -->
  55. <xsl:template match="answer">
  56.   <dd class="answer">
  57.     <xsl:choose>
  58.       <xsl:when test="@lang">
  59.         <xsl:attribute name="dir">
  60.           <xsl:call-template name="l10n.direction">
  61.             <xsl:with-param name="lang" select="@lang"/>
  62.           </xsl:call-template>
  63.         </xsl:attribute>
  64.       </xsl:when>
  65.       <xsl:when test="../@lang">
  66.         <xsl:attribute name="dir">
  67.           <xsl:call-template name="l10n.direction">
  68.             <xsl:with-param name="lang" select="../@lang"/>
  69.           </xsl:call-template>
  70.         </xsl:attribute>
  71.       </xsl:when>
  72.     </xsl:choose>
  73.     <div class="label">
  74.       <xsl:call-template name="db.label">
  75.         <xsl:with-param name="role" select="'header'"/>
  76.       </xsl:call-template>
  77.     </div>
  78.     <xsl:apply-templates/>
  79.   </dd>
  80. </xsl:template>
  81.  
  82. <!-- = qandadiv = -->
  83. <xsl:template match="qandadiv">
  84.   <xsl:param name="depth_in_chunk">
  85.     <xsl:call-template name="db.chunk.depth-in-chunk"/>
  86.   </xsl:param>
  87.   <xsl:param name="depth_of_chunk">
  88.     <xsl:call-template name="db.chunk.depth-of-chunk"/>
  89.   </xsl:param>
  90.   <xsl:call-template name="db2html.division.div">
  91.     <xsl:with-param name="info" select="blockinfo"/>
  92.     <xsl:with-param name="entries" select="qandaentry"/>
  93.     <xsl:with-param name="divisions" select="qandadiv"/>
  94.     <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
  95.     <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
  96.     <xsl:with-param name="chunk_divisions" select="false()"/>
  97.     <xsl:with-param name="chunk_info" select="false()"/>
  98.     <xsl:with-param name="autotoc_divisions" select="false()"/>
  99.   </xsl:call-template>
  100. </xsl:template>
  101.  
  102. <!-- = qandaentry = -->
  103. <xsl:template match="qandaentry">
  104.   <xsl:apply-templates/>
  105. </xsl:template>
  106.  
  107. <!-- = qandaset = -->
  108. <xsl:template match="qandaset">
  109.   <xsl:param name="depth_in_chunk">
  110.     <xsl:call-template name="db.chunk.depth-in-chunk"/>
  111.   </xsl:param>
  112.   <xsl:param name="depth_of_chunk">
  113.     <xsl:call-template name="db.chunk.depth-of-chunk"/>
  114.   </xsl:param>
  115.   <xsl:call-template name="db2html.division.div">
  116.     <xsl:with-param name="info" select="blockinfo"/>
  117.     <xsl:with-param name="entries" select="qandaentry"/>
  118.     <xsl:with-param name="divisions" select="qandadiv"/>
  119.     <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
  120.     <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
  121.     <xsl:with-param name="chunk_divisions" select="false()"/>
  122.     <xsl:with-param name="chunk_info" select="false()"/>
  123.     <xsl:with-param name="autotoc_divisions" select="true()"/>
  124.   </xsl:call-template>
  125. </xsl:template>
  126.  
  127. <!-- = question = -->
  128. <xsl:template match="question">
  129.   <!-- FIXME: dt-first -->
  130.   <dt class="question">
  131.     <xsl:choose>
  132.       <xsl:when test="@lang">
  133.         <xsl:attribute name="dir">
  134.           <xsl:call-template name="l10n.direction">
  135.             <xsl:with-param name="lang" select="@lang"/>
  136.           </xsl:call-template>
  137.         </xsl:attribute>
  138.       </xsl:when>
  139.       <xsl:when test="../@lang">
  140.         <xsl:attribute name="dir">
  141.           <xsl:call-template name="l10n.direction">
  142.             <xsl:with-param name="lang" select="../@lang"/>
  143.           </xsl:call-template>
  144.         </xsl:attribute>
  145.       </xsl:when>
  146.     </xsl:choose>
  147.     <div class="label">
  148.       <xsl:call-template name="db.label">
  149.         <xsl:with-param name="role" select="'header'"/>
  150.       </xsl:call-template>
  151.     </div>
  152.     <xsl:apply-templates/>
  153.   </dt>
  154. </xsl:template>
  155.  
  156. </xsl:stylesheet>
  157.