home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _A6A14734047D4C95B815B70BD7DDF1BD < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-04  |  29.8 KB  |  971 lines

  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.                 version='1.0'>
  4.  
  5. <!-- ********************************************************************
  6.      $Id: lists.xsl,v 1.1.2.1 2002/09/04 13:50:38 jdj Exp $
  7.      ********************************************************************
  8.  
  9.      This file is part of the XSL DocBook Stylesheet distribution.
  10.      See ../README or http://nwalsh.com/docbook/xsl/ for copyright
  11.      and other information.
  12.  
  13.      ******************************************************************** -->
  14.  
  15. <!-- ==================================================================== -->
  16.  
  17. <xsl:template match="itemizedlist">
  18.   <xsl:variable name="itemsymbol">
  19.     <xsl:call-template name="list.itemsymbol"/>
  20.   </xsl:variable>
  21.  
  22.   <div class="{name(.)}">
  23.     <xsl:call-template name="anchor"/>
  24.     <xsl:if test="title">
  25.       <xsl:call-template name="formal.object.heading"/>
  26.     </xsl:if>
  27.  
  28.     <xsl:apply-templates select="*[not(self::listitem or self::title)]"/>
  29.  
  30.     <ul type="{$itemsymbol}">
  31.       <xsl:if test="@spacing='compact'">
  32.         <xsl:attribute name="compact">
  33.           <xsl:value-of select="@spacing"/>
  34.         </xsl:attribute>
  35.       </xsl:if>
  36.       <xsl:apply-templates select="listitem"/>
  37.     </ul>
  38.   </div>
  39. </xsl:template>
  40.  
  41. <xsl:template match="itemizedlist/title">
  42.   <!-- nop -->
  43. </xsl:template>
  44.  
  45. <xsl:template match="itemizedlist/listitem">
  46.   <xsl:variable name="mark" select="../@mark"/>
  47.   <xsl:variable name="override" select="@override"/>
  48.  
  49.   <xsl:variable name="usemark">
  50.     <xsl:choose>
  51.       <xsl:when test="$override != ''">
  52.     <xsl:value-of select="$override"/>
  53.       </xsl:when>
  54.       <xsl:otherwise>
  55.     <xsl:value-of select="$mark"/>
  56.       </xsl:otherwise>
  57.     </xsl:choose>
  58.   </xsl:variable>
  59.  
  60.   <xsl:variable name="cssmark">
  61.     <xsl:choose>
  62.       <xsl:when test="$usemark = 'bullet'">disc</xsl:when>
  63.       <xsl:when test="$usemark = 'box'">square</xsl:when>
  64.       <xsl:otherwise>
  65.     <xsl:value-of select="$usemark"/>
  66.       </xsl:otherwise>
  67.     </xsl:choose>
  68.   </xsl:variable>
  69.  
  70.   <li>
  71.     <xsl:if test="$css.decoration = '1' and $cssmark != ''">
  72.       <xsl:attribute name="style">
  73.     <xsl:text>list-style-type: </xsl:text>
  74.     <xsl:value-of select="$cssmark"/>
  75.       </xsl:attribute>
  76.     </xsl:if>
  77.  
  78.     <!-- we can't just drop the anchor in since some browsers (Opera)
  79.          get confused about line breaks if we do. So if the first child
  80.          is a para, assume the para will put in the anchor. Otherwise,
  81.          put the anchor in anyway. -->
  82.     <xsl:if test="local-name(child::*[1]) != 'para'">
  83.       <xsl:call-template name="anchor"/>
  84.     </xsl:if>
  85.  
  86.     <xsl:choose>
  87.       <xsl:when test="$show.revisionflag != 0 and @revisionflag">
  88.     <div class="{@revisionflag}">
  89.       <xsl:apply-templates/>
  90.     </div>
  91.       </xsl:when>
  92.       <xsl:otherwise>
  93.     <xsl:apply-templates/>
  94.       </xsl:otherwise>
  95.     </xsl:choose>
  96.   </li>
  97. </xsl:template>
  98.  
  99. <xsl:template name="orderedlist-starting-number">
  100.   <xsl:param name="list" select="."/>
  101.   <xsl:choose>
  102.     <xsl:when test="$list/@continuation != 'continues'">1</xsl:when>
  103.     <xsl:otherwise>
  104.       <xsl:variable name="prevlist"
  105.                     select="$list/preceding::orderedlist[1]"/>
  106.       <xsl:choose>
  107.         <xsl:when test="count($prevlist) = 0">2</xsl:when>
  108.         <xsl:otherwise>
  109.           <xsl:variable name="prevlength" select="count($prevlist/listitem)"/>
  110.           <xsl:variable name="prevstart">
  111.             <xsl:call-template name="orderedlist-starting-number">
  112.               <xsl:with-param name="list" select="$prevlist"/>
  113.             </xsl:call-template>
  114.           </xsl:variable>
  115.           <xsl:value-of select="$prevstart + $prevlength"/>
  116.         </xsl:otherwise>
  117.       </xsl:choose>
  118.     </xsl:otherwise>
  119.   </xsl:choose>
  120. </xsl:template>
  121.  
  122. <xsl:template match="orderedlist">
  123.   <xsl:variable name="start">
  124.     <xsl:choose>
  125.       <xsl:when test="@continuation='continues'">
  126.         <xsl:call-template name="orderedlist-starting-number"/>
  127.       </xsl:when>
  128.       <xsl:otherwise>1</xsl:otherwise>
  129.     </xsl:choose>
  130.   </xsl:variable>
  131.  
  132.   <xsl:variable name="numeration">
  133.     <xsl:call-template name="list.numeration"/>
  134.   </xsl:variable>
  135.  
  136.   <xsl:variable name="type">
  137.     <xsl:choose>
  138.       <xsl:when test="$numeration='arabic'">1</xsl:when>
  139.       <xsl:when test="$numeration='loweralpha'">a</xsl:when>
  140.       <xsl:when test="$numeration='lowerroman'">i</xsl:when>
  141.       <xsl:when test="$numeration='upperalpha'">A</xsl:when>
  142.       <xsl:when test="$numeration='upperroman'">I</xsl:when>
  143.       <!-- What!? This should never happen -->
  144.       <xsl:otherwise>
  145.         <xsl:message>
  146.           <xsl:text>Unexpected numeration: </xsl:text>
  147.           <xsl:value-of select="$numeration"/>
  148.         </xsl:message>
  149.         <xsl:value-of select="1"/>
  150.       </xsl:otherwise>
  151.     </xsl:choose>
  152.   </xsl:variable>
  153.  
  154.   <div class="{name(.)}">
  155.     <xsl:call-template name="anchor"/>
  156.  
  157.     <xsl:if test="title">
  158.       <xsl:call-template name="formal.object.heading"/>
  159.     </xsl:if>
  160.  
  161.     <xsl:apply-templates select="*[not(self::listitem or self::title)]"/>
  162.  
  163.     <ol>
  164.       <xsl:if test="$start != '1'">
  165.         <xsl:attribute name="start">
  166.           <xsl:value-of select="$start"/>
  167.         </xsl:attribute>
  168.       </xsl:if>
  169.       <xsl:if test="$numeration != ''">
  170.         <xsl:attribute name="type">
  171.           <xsl:value-of select="$type"/>
  172.         </xsl:attribute>
  173.       </xsl:if>
  174.       <xsl:if test="@spacing='compact'">
  175.         <xsl:attribute name="compact">
  176.           <xsl:value-of select="compact"/>
  177.         </xsl:attribute>
  178.       </xsl:if>
  179.       <xsl:apply-templates select="listitem"/>
  180.     </ol>
  181.   </div>
  182. </xsl:template>
  183.  
  184. <xsl:template match="orderedlist/title">
  185.   <!-- nop -->
  186. </xsl:template>
  187.  
  188. <xsl:template match="orderedlist/listitem">
  189.   <li>
  190.     <xsl:if test="@override">
  191.       <xsl:attribute name="value">
  192.         <xsl:value-of select="@override"/>
  193.       </xsl:attribute>
  194.     </xsl:if>
  195.  
  196.     <!-- we can't just drop the anchor in since some browsers (Opera)
  197.          get confused about line breaks if we do. So if the first child
  198.          is a para, assume the para will put in the anchor. Otherwise,
  199.          put the anchor in anyway. -->
  200.     <xsl:if test="local-name(child::*[1]) != 'para'">
  201.       <xsl:call-template name="anchor"/>
  202.     </xsl:if>
  203.  
  204.     <xsl:choose>
  205.       <xsl:when test="$show.revisionflag != 0 and @revisionflag">
  206.     <div class="{@revisionflag}">
  207.       <xsl:apply-templates/>
  208.     </div>
  209.       </xsl:when>
  210.       <xsl:otherwise>
  211.     <xsl:apply-templates/>
  212.       </xsl:otherwise>
  213.     </xsl:choose>
  214.   </li>
  215. </xsl:template>
  216.  
  217. <xsl:template match="variablelist">
  218.   <xsl:variable name="pi-presentation">
  219.     <xsl:call-template name="dbhtml-attribute">
  220.       <xsl:with-param name="pis"
  221.                       select="processing-instruction('dbhtml')"/>
  222.       <xsl:with-param name="attribute" select="'list-presentation'"/>
  223.     </xsl:call-template>
  224.   </xsl:variable>
  225.  
  226.   <xsl:variable name="presentation">
  227.     <xsl:choose>
  228.       <xsl:when test="$pi-presentation != ''">
  229.         <xsl:value-of select="$pi-presentation"/>
  230.       </xsl:when>
  231.       <xsl:when test="$variablelist.as.table != 0">
  232.         <xsl:value-of select="'table'"/>
  233.       </xsl:when>
  234.       <xsl:otherwise>
  235.         <xsl:value-of select="'list'"/>
  236.       </xsl:otherwise>
  237.     </xsl:choose>
  238.   </xsl:variable>
  239.  
  240.   <xsl:variable name="list-width">
  241.     <xsl:call-template name="dbhtml-attribute">
  242.       <xsl:with-param name="pis"
  243.                       select="processing-instruction('dbhtml')"/>
  244.       <xsl:with-param name="attribute" select="'list-width'"/>
  245.     </xsl:call-template>
  246.   </xsl:variable>
  247.  
  248.   <xsl:variable name="term-width">
  249.     <xsl:call-template name="dbhtml-attribute">
  250.       <xsl:with-param name="pis"
  251.                       select="processing-instruction('dbhtml')"/>
  252.       <xsl:with-param name="attribute" select="'term-width'"/>
  253.     </xsl:call-template>
  254.   </xsl:variable>
  255.  
  256.   <xsl:variable name="table-summary">
  257.     <xsl:call-template name="dbhtml-attribute">
  258.       <xsl:with-param name="pis"
  259.                       select="processing-instruction('dbhtml')"/>
  260.       <xsl:with-param name="attribute" select="'table-summary'"/>
  261.     </xsl:call-template>
  262.   </xsl:variable>
  263.  
  264.   <div class="{name(.)}">
  265.     <xsl:call-template name="anchor"/>
  266.     <xsl:if test="title">
  267.       <xsl:call-template name="formal.object.heading"/>
  268.     </xsl:if>
  269.  
  270.     <xsl:choose>
  271.       <xsl:when test="$presentation = 'table'">
  272.         <table border="0">
  273.           <xsl:if test="$list-width != ''">
  274.             <xsl:attribute name="width">
  275.               <xsl:value-of select="$list-width"/>
  276.             </xsl:attribute>
  277.           </xsl:if>
  278.           <xsl:if test="$table-summary != ''">
  279.             <xsl:attribute name="summary">
  280.               <xsl:value-of select="$table-summary"/>
  281.             </xsl:attribute>
  282.           </xsl:if>
  283.           <col align="left" valign="top">
  284.             <xsl:if test="$term-width != ''">
  285.               <xsl:attribute name="width">
  286.                 <xsl:value-of select="$term-width"/>
  287.               </xsl:attribute>
  288.             </xsl:if>
  289.           </col>
  290.           <tbody>
  291.             <xsl:apply-templates select="varlistentry" mode="varlist-table"/>
  292.           </tbody>
  293.         </table>
  294.       </xsl:when>
  295.       <xsl:otherwise>
  296.         <dl>
  297.           <xsl:apply-templates select="varlistentry"/>
  298.         </dl>
  299.       </xsl:otherwise>
  300.     </xsl:choose>
  301.   </div>
  302. </xsl:template>
  303.  
  304. <xsl:template match="variablelist/title">
  305.   <!-- nop -->
  306. </xsl:template>
  307.  
  308. <xsl:template match="listitem" mode="xref">
  309.   <xsl:number format="1"/>
  310. </xsl:template>
  311.  
  312. <xsl:template match="listitem/simpara" priority="2">
  313.   <!-- If a listitem contains only a single simpara, don't output
  314.        the <p> wrapper; this has the effect of creating an li
  315.        with simple text content. -->
  316.   <xsl:choose>
  317.     <xsl:when test="not(preceding-sibling::*)
  318.                     and not (following-sibling::*)">
  319.       <xsl:call-template name="anchor"/>
  320.       <xsl:apply-templates/>
  321.     </xsl:when>
  322.     <xsl:otherwise>
  323.       <p>
  324.         <xsl:if test="@role and $para.propagates.style != 0">
  325.           <xsl:attribute name="class">
  326.             <xsl:value-of select="@role"/>
  327.           </xsl:attribute>
  328.         </xsl:if>
  329.  
  330.         <xsl:call-template name="anchor"/>
  331.         <xsl:apply-templates/>
  332.       </p>
  333.     </xsl:otherwise>
  334.   </xsl:choose>
  335. </xsl:template>
  336.  
  337. <xsl:template match="varlistentry">
  338.   <dt>
  339.     <xsl:call-template name="anchor"/>
  340.     <xsl:apply-templates select="term"/>
  341.   </dt>
  342.   <dd>
  343.     <xsl:apply-templates select="listitem"/>
  344.   </dd>
  345. </xsl:template>
  346.  
  347. <xsl:template match="varlistentry" mode="varlist-table">
  348.   <xsl:variable name="presentation">
  349.     <xsl:call-template name="dbhtml-attribute">
  350.       <xsl:with-param name="pis"
  351.                       select="../processing-instruction('dbhtml')"/>
  352.       <xsl:with-param name="attribute" select="'term-presentation'"/>
  353.     </xsl:call-template>
  354.   </xsl:variable>
  355.  
  356.   <xsl:variable name="separator">
  357.     <xsl:call-template name="dbhtml-attribute">
  358.       <xsl:with-param name="pis"
  359.                       select="../processing-instruction('dbhtml')"/>
  360.       <xsl:with-param name="attribute" select="'term-separator'"/>
  361.     </xsl:call-template>
  362.   </xsl:variable>
  363.   <tr>
  364.     <xsl:call-template name="tr.attributes">
  365.       <xsl:with-param name="rownum">
  366.         <xsl:number from="variablelist" count="varlistentry"/>
  367.       </xsl:with-param>
  368.     </xsl:call-template>
  369.  
  370.     <td>
  371.       <xsl:call-template name="anchor"/>
  372.       <xsl:choose>
  373.         <xsl:when test="$presentation = 'bold'">
  374.           <b>
  375.             <xsl:apply-templates select="term"/>
  376.             <xsl:value-of select="$separator"/>
  377.           </b>
  378.         </xsl:when>
  379.         <xsl:when test="$presentation = 'italic'">
  380.           <i>
  381.             <xsl:apply-templates select="term"/>
  382.             <xsl:value-of select="$separator"/>
  383.           </i>
  384.         </xsl:when>
  385.         <xsl:when test="$presentation = 'bold-italic'">
  386.           <b>
  387.             <i>
  388.               <xsl:apply-templates select="term"/>
  389.               <xsl:value-of select="$separator"/>
  390.             </i>
  391.           </b>
  392.         </xsl:when>
  393.         <xsl:otherwise>
  394.           <xsl:apply-templates select="term"/>
  395.           <xsl:value-of select="$separator"/>
  396.         </xsl:otherwise>
  397.       </xsl:choose>
  398.     </td>
  399.     <td>
  400.       <xsl:apply-templates select="listitem"/>
  401.     </td>
  402.   </tr>
  403. </xsl:template>
  404.  
  405. <xsl:template match="varlistentry/term">
  406.   <span class="term">
  407.     <xsl:call-template name="anchor"/>
  408.     <xsl:apply-templates/>
  409.     <xsl:text>, </xsl:text>
  410.   </span>
  411. </xsl:template>
  412.  
  413. <xsl:template match="varlistentry/term[position()=last()]" priority="2">
  414.   <span class="term">
  415.     <xsl:call-template name="anchor"/>
  416.     <xsl:apply-templates/>
  417.   </span>
  418. </xsl:template>
  419.  
  420. <xsl:template match="varlistentry/listitem">
  421.   <xsl:choose>
  422.     <xsl:when test="$show.revisionflag != 0 and @revisionflag">
  423.       <div class="{@revisionflag}">
  424.     <xsl:apply-templates/>
  425.       </div>
  426.     </xsl:when>
  427.     <xsl:otherwise>
  428.       <xsl:apply-templates/>
  429.     </xsl:otherwise>
  430.   </xsl:choose>
  431. </xsl:template>
  432.  
  433. <!-- ==================================================================== -->
  434.  
  435. <xsl:template match="simplelist">
  436.   <!-- with no type specified, the default is 'vert' -->
  437.   <xsl:call-template name="anchor"/>
  438.   <table class="simplelist" border="0" summary="Simple list">
  439.     <xsl:call-template name="simplelist.vert">
  440.       <xsl:with-param name="cols">
  441.     <xsl:choose>
  442.       <xsl:when test="@columns">
  443.         <xsl:value-of select="@columns"/>
  444.       </xsl:when>
  445.       <xsl:otherwise>1</xsl:otherwise>
  446.     </xsl:choose>
  447.       </xsl:with-param>
  448.     </xsl:call-template>
  449.   </table>
  450. </xsl:template>
  451.  
  452. <xsl:template match="simplelist[@type='inline']">
  453.   <span class="{name(.)}">
  454.     <xsl:call-template name="anchor"/>
  455.     <xsl:apply-templates/>
  456.   </span>
  457. </xsl:template>
  458.  
  459. <xsl:template match="simplelist[@type='horiz']">
  460.   <xsl:call-template name="anchor"/>
  461.   <table class="simplelist" border="0" summary="Simple list">
  462.     <xsl:call-template name="simplelist.horiz">
  463.       <xsl:with-param name="cols">
  464.         <xsl:choose>
  465.           <xsl:when test="@columns">
  466.             <xsl:value-of select="@columns"/>
  467.           </xsl:when>
  468.           <xsl:otherwise>1</xsl:otherwise>
  469.         </xsl:choose>
  470.       </xsl:with-param>
  471.     </xsl:call-template>
  472.   </table>
  473. </xsl:template>
  474.  
  475. <xsl:template match="simplelist[@type='vert']">
  476.   <xsl:call-template name="anchor"/>
  477.   <table class="simplelist" border="0" summary="Simple list">
  478.     <xsl:call-template name="simplelist.vert">
  479.       <xsl:with-param name="cols">
  480.         <xsl:choose>
  481.           <xsl:when test="@columns">
  482.             <xsl:value-of select="@columns"/>
  483.           </xsl:when>
  484.           <xsl:otherwise>1</xsl:otherwise>
  485.         </xsl:choose>
  486.       </xsl:with-param>
  487.     </xsl:call-template>
  488.   </table>
  489. </xsl:template>
  490.  
  491. <xsl:template name="simplelist.horiz">
  492.   <xsl:param name="cols">1</xsl:param>
  493.   <xsl:param name="cell">1</xsl:param>
  494.   <xsl:param name="members" select="./member"/>
  495.  
  496.   <xsl:if test="$cell <= count($members)">
  497.     <tr>
  498.       <xsl:call-template name="tr.attributes">
  499.         <xsl:with-param name="row" select="$members[1]"/>
  500.         <xsl:with-param name="rownum" select="(($cell - 1) div $cols) + 1"/>
  501.       </xsl:call-template>
  502.  
  503.       <xsl:call-template name="simplelist.horiz.row">
  504.         <xsl:with-param name="cols" select="$cols"/>
  505.         <xsl:with-param name="cell" select="$cell"/>
  506.         <xsl:with-param name="members" select="$members"/>
  507.       </xsl:call-template>
  508.    </tr>
  509.     <xsl:call-template name="simplelist.horiz">
  510.       <xsl:with-param name="cols" select="$cols"/>
  511.       <xsl:with-param name="cell" select="$cell + $cols"/>
  512.       <xsl:with-param name="members" select="$members"/>
  513.     </xsl:call-template>
  514.   </xsl:if>
  515. </xsl:template>
  516.  
  517. <xsl:template name="simplelist.horiz.row">
  518.   <xsl:param name="cols">1</xsl:param>
  519.   <xsl:param name="cell">1</xsl:param>
  520.   <xsl:param name="members" select="./member"/>
  521.   <xsl:param name="curcol">1</xsl:param>
  522.  
  523.   <xsl:if test="$curcol <= $cols">
  524.     <td>
  525.       <xsl:choose>
  526.         <xsl:when test="$members[position()=$cell]">
  527.           <xsl:apply-templates select="$members[position()=$cell]"/>
  528.         </xsl:when>
  529.         <xsl:otherwise>
  530.           <xsl:text> </xsl:text>
  531.         </xsl:otherwise>
  532.       </xsl:choose>
  533.     </td>
  534.     <xsl:call-template name="simplelist.horiz.row">
  535.       <xsl:with-param name="cols" select="$cols"/>
  536.       <xsl:with-param name="cell" select="$cell+1"/>
  537.       <xsl:with-param name="members" select="$members"/>
  538.       <xsl:with-param name="curcol" select="$curcol+1"/>
  539.     </xsl:call-template>
  540.   </xsl:if>
  541. </xsl:template>
  542.  
  543. <xsl:template name="simplelist.vert">
  544.   <xsl:param name="cols">1</xsl:param>
  545.   <xsl:param name="cell">1</xsl:param>
  546.   <xsl:param name="members" select="./member"/>
  547.   <xsl:param name="rows"
  548.              select="floor((count($members)+$cols - 1) div $cols)"/>
  549.  
  550.   <xsl:if test="$cell <= $rows">
  551.     <tr>
  552.       <xsl:call-template name="tr.attributes">
  553.         <xsl:with-param name="row" select="$members[1]"/>
  554.         <xsl:with-param name="rownum" select="$cell"/>
  555.       </xsl:call-template>
  556.  
  557.       <xsl:call-template name="simplelist.vert.row">
  558.     <xsl:with-param name="cols" select="$cols"/>
  559.     <xsl:with-param name="rows" select="$rows"/>
  560.     <xsl:with-param name="cell" select="$cell"/>
  561.     <xsl:with-param name="members" select="$members"/>
  562.       </xsl:call-template>
  563.     </tr>
  564.     <xsl:call-template name="simplelist.vert">
  565.       <xsl:with-param name="cols" select="$cols"/>
  566.       <xsl:with-param name="cell" select="$cell+1"/>
  567.       <xsl:with-param name="members" select="$members"/>
  568.       <xsl:with-param name="rows" select="$rows"/>
  569.     </xsl:call-template>
  570.   </xsl:if>
  571. </xsl:template>
  572.  
  573. <xsl:template name="simplelist.vert.row">
  574.   <xsl:param name="cols">1</xsl:param>
  575.   <xsl:param name="rows">1</xsl:param>
  576.   <xsl:param name="cell">1</xsl:param>
  577.   <xsl:param name="members" select="./member"/>
  578.   <xsl:param name="curcol">1</xsl:param>
  579.  
  580.   <xsl:if test="$curcol <= $cols">
  581.     <td>
  582.       <xsl:choose>
  583.         <xsl:when test="$members[position()=$cell]">
  584.           <xsl:apply-templates select="$members[position()=$cell]"/>
  585.         </xsl:when>
  586.         <xsl:otherwise>
  587.           <xsl:text> </xsl:text>
  588.         </xsl:otherwise>
  589.       </xsl:choose>
  590.     </td>
  591.     <xsl:call-template name="simplelist.vert.row">
  592.       <xsl:with-param name="cols" select="$cols"/>
  593.       <xsl:with-param name="rows" select="$rows"/>
  594.       <xsl:with-param name="cell" select="$cell+$rows"/>
  595.       <xsl:with-param name="members" select="$members"/>
  596.       <xsl:with-param name="curcol" select="$curcol+1"/>
  597.     </xsl:call-template>
  598.   </xsl:if>
  599. </xsl:template>
  600.  
  601. <xsl:template match="member">
  602.   <xsl:apply-templates/>
  603. </xsl:template>
  604.  
  605. <xsl:template match="simplelist[@type='inline']/member">
  606.   <xsl:apply-templates/>
  607.   <xsl:text>, </xsl:text>
  608. </xsl:template>
  609.  
  610. <xsl:template match="simplelist[@type='inline']/member[position()=last()]"
  611.               priority="2">
  612.   <xsl:apply-templates/>
  613. </xsl:template>
  614.  
  615. <!-- ==================================================================== -->
  616.  
  617. <xsl:template match="procedure">
  618.   <xsl:variable name="param.placement"
  619.                 select="substring-after(normalize-space($formal.title.placement),
  620.                                         concat(local-name(.), ' '))"/>
  621.  
  622.   <xsl:variable name="placement">
  623.     <xsl:choose>
  624.       <xsl:when test="contains($param.placement, ' ')">
  625.         <xsl:value-of select="substring-before($param.placement, ' ')"/>
  626.       </xsl:when>
  627.       <xsl:when test="$param.placement = ''">before</xsl:when>
  628.       <xsl:otherwise>
  629.         <xsl:value-of select="$param.placement"/>
  630.       </xsl:otherwise>
  631.     </xsl:choose>
  632.   </xsl:variable>
  633.  
  634.   <xsl:variable name="preamble"
  635.                 select="*[not(self::step or self::title)]"/>
  636.  
  637.   <div class="{name(.)}">
  638.     <xsl:call-template name="anchor"/>
  639.  
  640.     <xsl:if test="title and $placement = 'before'">
  641.       <xsl:call-template name="formal.object.heading"/>
  642.     </xsl:if>
  643.  
  644.     <xsl:apply-templates select="$preamble"/>
  645.  
  646.     <xsl:choose>
  647.       <xsl:when test="count(step) = 1">
  648.         <ul>
  649.           <xsl:apply-templates select="step"/>
  650.         </ul>
  651.       </xsl:when>
  652.       <xsl:otherwise>
  653.         <ol>
  654.           <xsl:attribute name="type">
  655.             <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
  656.           </xsl:attribute>
  657.           <xsl:apply-templates select="step"/>
  658.         </ol>
  659.       </xsl:otherwise>
  660.     </xsl:choose>
  661.  
  662.     <xsl:if test="title and $placement != 'before'">
  663.       <xsl:call-template name="formal.object.heading"/>
  664.     </xsl:if>
  665.   </div>
  666. </xsl:template>
  667.  
  668. <xsl:template match="procedure/title">
  669.   <!-- nop -->
  670. </xsl:template>
  671.  
  672. <xsl:template match="substeps">
  673.   <xsl:variable name="numeration">
  674.     <xsl:call-template name="procedure.step.numeration"/>
  675.   </xsl:variable>
  676.  
  677.   <xsl:call-template name="anchor"/>
  678.  
  679.   <ol type="{$numeration}">
  680.     <xsl:apply-templates/>
  681.   </ol>
  682. </xsl:template>
  683.  
  684. <xsl:template match="step">
  685.   <li>
  686.     <xsl:call-template name="anchor"/>
  687.     <xsl:apply-templates/>
  688.   </li>
  689. </xsl:template>
  690.  
  691. <xsl:template match="step/title">
  692.   <p class="title">
  693.     <b>
  694.       <xsl:apply-templates/>
  695.     </b>
  696.   </p>
  697. </xsl:template>
  698.  
  699. <!-- ==================================================================== -->
  700.  
  701. <xsl:template match="segmentedlist">
  702.   <xsl:variable name="presentation">
  703.     <xsl:call-template name="dbhtml-attribute">
  704.       <xsl:with-param name="pis"
  705.                       select="processing-instruction('dbhtml')"/>
  706.       <xsl:with-param name="attribute" select="'list-presentation'"/>
  707.     </xsl:call-template>
  708.   </xsl:variable>
  709.  
  710.   <div class="{name(.)}">
  711.     <xsl:call-template name="anchor"/>
  712.  
  713.     <xsl:choose>
  714.       <xsl:when test="$presentation = 'table'">
  715.         <xsl:apply-templates select="." mode="seglist-table"/>
  716.       </xsl:when>
  717.       <xsl:when test="$presentation = 'list'">
  718.         <xsl:apply-templates/>
  719.       </xsl:when>
  720.       <xsl:when test="$segmentedlist.as.table != 0">
  721.         <xsl:apply-templates select="." mode="seglist-table"/>
  722.       </xsl:when>
  723.       <xsl:otherwise>
  724.         <xsl:apply-templates/>
  725.       </xsl:otherwise>
  726.     </xsl:choose>
  727.   </div>
  728. </xsl:template>
  729.  
  730. <xsl:template match="segmentedlist/title">
  731.   <p><b><xsl:apply-templates/></b></p>
  732. </xsl:template>
  733.  
  734. <xsl:template match="segtitle">
  735. </xsl:template>
  736.  
  737. <xsl:template match="segtitle" mode="segtitle-in-seg">
  738.   <xsl:apply-templates/>
  739. </xsl:template>
  740.  
  741. <xsl:template match="seglistitem">
  742.   <xsl:apply-templates/>
  743. </xsl:template>
  744.  
  745. <xsl:template match="seg">
  746.   <xsl:variable name="segnum" select="position()"/>
  747.   <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
  748.   <xsl:variable name="segtitles" select="$seglist/segtitle"/>
  749.  
  750.   <!--
  751.      Note: segtitle is only going to be the right thing in a well formed
  752.      SegmentedList.  If there are too many Segs or too few SegTitles,
  753.      you'll get something odd...maybe an error
  754.   -->
  755.  
  756.   <p>
  757.     <b>
  758.       <xsl:apply-templates select="$segtitles[$segnum=position()]"
  759.                            mode="segtitle-in-seg"/>
  760.       <xsl:text>: </xsl:text>
  761.     </b>
  762.     <xsl:apply-templates/>
  763.   </p>
  764. </xsl:template>
  765.  
  766. <xsl:template match="segmentedlist" mode="seglist-table">
  767.   <xsl:variable name="table-summary">
  768.     <xsl:call-template name="dbhtml-attribute">
  769.       <xsl:with-param name="pis"
  770.                       select="processing-instruction('dbhtml')"/>
  771.       <xsl:with-param name="attribute" select="'table-summary'"/>
  772.     </xsl:call-template>
  773.   </xsl:variable>
  774.  
  775.   <xsl:variable name="list-width">
  776.     <xsl:call-template name="dbhtml-attribute">
  777.       <xsl:with-param name="pis"
  778.                       select="processing-instruction('dbhtml')"/>
  779.       <xsl:with-param name="attribute" select="'list-width'"/>
  780.     </xsl:call-template>
  781.   </xsl:variable>
  782.  
  783.   <xsl:apply-templates select="title"/>
  784.  
  785.   <table border="0">
  786.     <xsl:if test="$list-width != ''">
  787.       <xsl:attribute name="width">
  788.         <xsl:value-of select="$list-width"/>
  789.       </xsl:attribute>
  790.     </xsl:if>
  791.     <xsl:if test="$table-summary != ''">
  792.       <xsl:attribute name="summary">
  793.         <xsl:value-of select="$table-summary"/>
  794.       </xsl:attribute>
  795.     </xsl:if>
  796.     <thead>
  797.       <tr>
  798.         <xsl:call-template name="tr.attributes">
  799.           <xsl:with-param name="row" select="segtitle[1]"/>
  800.           <xsl:with-param name="rownum" select="1"/>
  801.         </xsl:call-template>
  802.         <xsl:apply-templates select="segtitle" mode="seglist-table"/>
  803.       </tr>
  804.     </thead>
  805.     <tbody>
  806.       <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
  807.     </tbody>
  808.   </table>
  809. </xsl:template>
  810.  
  811. <xsl:template match="segtitle" mode="seglist-table">
  812.   <th><xsl:apply-templates/></th>
  813. </xsl:template>
  814.  
  815. <xsl:template match="seglistitem" mode="seglist-table">
  816.   <xsl:variable name="seglinum">
  817.     <xsl:number from="segmentedlist" count="seglistitem"/>
  818.   </xsl:variable>
  819.  
  820.   <tr>
  821.     <xsl:call-template name="tr.attributes">
  822.       <xsl:with-param name="rownum" select="$seglinum + 1"/>
  823.     </xsl:call-template>
  824.     <xsl:apply-templates mode="seglist-table"/>
  825.   </tr>
  826. </xsl:template>
  827.  
  828. <xsl:template match="seg" mode="seglist-table">
  829.   <td><xsl:apply-templates/></td>
  830. </xsl:template>
  831.  
  832. <!-- ==================================================================== -->
  833.  
  834. <xsl:template match="calloutlist">
  835.   <div class="{name(.)}">
  836.     <xsl:call-template name="anchor"/>
  837.     <xsl:if test="title">
  838.       <xsl:call-template name="formal.object.heading"/>
  839.     </xsl:if>
  840.     <xsl:choose>
  841.       <xsl:when test="$callout.list.table != 0">
  842.         <table border="0" summary="Callout list">
  843.           <xsl:apply-templates/>
  844.         </table>
  845.       </xsl:when>
  846.       <xsl:otherwise>
  847.         <dl compact="compact"><xsl:apply-templates/></dl>
  848.       </xsl:otherwise>
  849.     </xsl:choose>
  850.   </div>
  851. </xsl:template>
  852.  
  853. <xsl:template match="calloutlist/title">
  854. </xsl:template>
  855.  
  856. <xsl:template match="callout">
  857.   <xsl:choose>
  858.     <xsl:when test="$callout.list.table != 0">
  859.       <tr>
  860.         <xsl:call-template name="tr.attributes">
  861.           <xsl:with-param name="rownum">
  862.             <xsl:number from="calloutlist" count="callout"/>
  863.           </xsl:with-param>
  864.         </xsl:call-template>
  865.  
  866.         <td width="5%" valign="top" align="left">
  867.           <xsl:call-template name="anchor"/>
  868.           <xsl:call-template name="callout.arearefs">
  869.             <xsl:with-param name="arearefs" select="@arearefs"/>
  870.           </xsl:call-template>
  871.         </td>
  872.         <td valign="top" align="left">
  873.           <xsl:apply-templates/>
  874.         </td>
  875.       </tr>
  876.     </xsl:when>
  877.     <xsl:otherwise>
  878.       <dt>
  879.         <xsl:call-template name="anchor"/>
  880.         <xsl:call-template name="callout.arearefs">
  881.           <xsl:with-param name="arearefs" select="@arearefs"/>
  882.         </xsl:call-template>
  883.       </dt>
  884.       <dd><xsl:apply-templates/></dd>
  885.     </xsl:otherwise>
  886.   </xsl:choose>
  887. </xsl:template>
  888.  
  889. <xsl:template name="callout.arearefs">
  890.   <xsl:param name="arearefs"></xsl:param>
  891.   <xsl:if test="$arearefs!=''">
  892.     <xsl:choose>
  893.       <xsl:when test="substring-before($arearefs,' ')=''">
  894.         <xsl:call-template name="callout.arearef">
  895.           <xsl:with-param name="arearef" select="$arearefs"/>
  896.         </xsl:call-template>
  897.       </xsl:when>
  898.       <xsl:otherwise>
  899.         <xsl:call-template name="callout.arearef">
  900.           <xsl:with-param name="arearef"
  901.                           select="substring-before($arearefs,' ')"/>
  902.         </xsl:call-template>
  903.       </xsl:otherwise>
  904.     </xsl:choose>
  905.     <xsl:call-template name="callout.arearefs">
  906.       <xsl:with-param name="arearefs"
  907.                       select="substring-after($arearefs,' ')"/>
  908.     </xsl:call-template>
  909.   </xsl:if>
  910. </xsl:template>
  911.  
  912. <xsl:template name="callout.arearef">
  913.   <xsl:param name="arearef"></xsl:param>
  914.   <xsl:variable name="targets" select="key('id',$arearef)"/>
  915.   <xsl:variable name="target" select="$targets[1]"/>
  916.  
  917.   <xsl:call-template name="check.id.unique">
  918.     <xsl:with-param name="linkend" select="$arearef"/>
  919.   </xsl:call-template>
  920.  
  921.   <xsl:choose>
  922.     <xsl:when test="count($target)=0">
  923.       <xsl:text>???</xsl:text>
  924.     </xsl:when>
  925.     <xsl:when test="local-name($target)='co'">
  926.       <a>
  927.         <xsl:attribute name="href">
  928.           <xsl:text>#</xsl:text>
  929.           <xsl:value-of select="$arearef"/>
  930.         </xsl:attribute>
  931.         <xsl:apply-templates select="$target" mode="callout-bug"/>
  932.       </a>
  933.       <xsl:text> </xsl:text>
  934.     </xsl:when>
  935.     <xsl:when test="local-name($target)='areaset'">
  936.       <xsl:call-template name="callout-bug">
  937.         <xsl:with-param name="conum">
  938.           <xsl:apply-templates select="$target" mode="conumber"/>
  939.         </xsl:with-param>
  940.       </xsl:call-template>
  941.     </xsl:when>
  942.     <xsl:when test="local-name($target)='area'">
  943.       <xsl:choose>
  944.         <xsl:when test="$target/parent::areaset">
  945.           <xsl:call-template name="callout-bug">
  946.             <xsl:with-param name="conum">
  947.               <xsl:apply-templates select="$target/parent::areaset"
  948.                                    mode="conumber"/>
  949.             </xsl:with-param>
  950.           </xsl:call-template>
  951.         </xsl:when>
  952.         <xsl:otherwise>
  953.           <xsl:call-template name="callout-bug">
  954.             <xsl:with-param name="conum">
  955.               <xsl:apply-templates select="$target" mode="conumber"/>
  956.             </xsl:with-param>
  957.           </xsl:call-template>
  958.         </xsl:otherwise>
  959.       </xsl:choose>
  960.     </xsl:when>
  961.     <xsl:otherwise>
  962.       <xsl:text>???</xsl:text>
  963.     </xsl:otherwise>
  964.   </xsl:choose>
  965. </xsl:template>
  966.  
  967. <!-- ==================================================================== -->
  968.  
  969. </xsl:stylesheet>
  970.  
  971.