2 <axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbk="http://docbook.org/ns/docbook" xmlns:rnd="http://docbook.org/ns/docbook/roundtrip" version="1.0">
 
   3 <!--====================================-->
 
   5 <!--=   DO NOT EDIT THIS STYLESHEET    =-->
 
   7 <!--= This stylesheet is generated     =-->
 
   8 <!--= by makeSubsections.xsl and a     =-->
 
   9 <!--= mapping specification.           =-->
 
  11 <!--= Revision history:                =-->
 
  12 <!--=  1.1 2007-01-10 SRB              =-->
 
  13 <!--=   Output DocBook 5.0.            =-->
 
  14 <!--=  1.0 2005-11-08 SRB              =-->
 
  15 <!--=   Initial version.               =-->
 
  17 <!--= $Id: sections2blocks.xsl 8107 2008-08-17 22:39:58Z balls $ =-->
 
  19 <!--====================================-->
 
  20   <axsl:output indent="yes"/>
 
  21   <axsl:strip-space elements="*"/>
 
  22   <axsl:preserve-space elements="dbk:para dbk:emphasis"/>
 
  23   <axsl:template match="dbk:appendix |
  dbk:article |
  dbk:book |
  dbk:chapter |
  dbk:part |
  dbk:preface |
  dbk:section |
  dbk:sect1 |
  dbk:sect2 |
  dbk:sect3 |
  dbk:sect4 |
  dbk:sect5">
 
  24     <axsl:variable name="subsections" select="dbk:para[@rnd:style = "bibliography" or @rnd:style = "bibliography-title" or @rnd:style = "glossary" or @rnd:style = "glossary-title" or @rnd:style = "qandaset" or @rnd:style = "qandaset-title"]"/>
 
  26       <axsl:apply-templates select="@*"/>
 
  28         <axsl:when test="$subsections">
 
  29           <axsl:apply-templates select="$subsections[1]/preceding-sibling::node()"/>
 
  30           <axsl:apply-templates select="$subsections[1]" mode="subsections">
 
  31             <axsl:with-param name="subsections" select="$subsections[position() != 1]"/>
 
  32           </axsl:apply-templates>
 
  34         <axsl:when test="dbk:appendix |
  dbk:article |
  dbk:book |
  dbk:chapter |
  dbk:part |
  dbk:preface |
  dbk:section |
  dbk:sect1 |
  dbk:sect2 |
  dbk:sect3 |
  dbk:sect4 |
  dbk:sect5">
 
  35           <axsl:apply-templates select="*[self::dbk:appendix |
  self::dbk:article |
  self::dbk:book |
  self::dbk:chapter |
  self::dbk:part |
  self::dbk:preface |
  self::dbk:section |
  self::dbk:sect1 |
  self::dbk:sect2 |
  self::dbk:sect3 |
  self::dbk:sect4 |
  self::dbk:sect5][1]/preceding-sibling::node()"/>
 
  36           <axsl:apply-templates select="dbk:appendix |
  dbk:article |
  dbk:book |
  dbk:chapter |
  dbk:part |
  dbk:preface |
  dbk:section |
  dbk:sect1 |
  dbk:sect2 |
  dbk:sect3 |
  dbk:sect4 |
  dbk:sect5"/>
 
  39           <axsl:apply-templates/>
 
  44       <axsl:when test="following-sibling::*[self::dbk:appendix |
  self::dbk:article |
  self::dbk:book |
  self::dbk:chapter |
  self::dbk:part |
  self::dbk:preface |
  self::dbk:section |
  self::dbk:sect1 |
  self::dbk:sect2 |
  self::dbk:sect3 |
  self::dbk:sect4 |
  self::dbk:sect5] | following-sibling::dbk:para[@rnd:style = "bibliography" or @rnd:style = "bibliography-title" or @rnd:style = "glossary" or @rnd:style = "glossary-title" or @rnd:style = "qandaset" or @rnd:style = "qandaset-title"]">
 
  45         <axsl:variable name="nextComponent" select="following-sibling::*[self::dbk:appendix |
  self::dbk:article |
  self::dbk:book |
  self::dbk:chapter |
  self::dbk:part |
  self::dbk:preface |
  self::dbk:section |
  self::dbk:sect1 |
  self::dbk:sect2 |
  self::dbk:sect3 |
  self::dbk:sect4 |
  self::dbk:sect5|self::dbk:para[@rnd:style = "bibliography" or @rnd:style = "bibliography-title" or @rnd:style = "glossary" or @rnd:style = "glossary-title" or @rnd:style = "qandaset" or @rnd:style = "qandaset-title"]][1]"/>
 
  46         <axsl:apply-templates select="following-sibling::*[generate-id(following-sibling::*[self::dbk:appendix |
  self::dbk:article |
  self::dbk:book |
  self::dbk:chapter |
  self::dbk:part |
  self::dbk:preface |
  self::dbk:section |
  self::dbk:sect1 |
  self::dbk:sect2 |
  self::dbk:sect3 |
  self::dbk:sect4 |
  self::dbk:sect5|self::dbk:para[@rnd:style = "bibliography" or @rnd:style = "bibliography-title" or @rnd:style = "glossary" or @rnd:style = "glossary-title" or @rnd:style = "qandaset" or @rnd:style = "qandaset-title"]][1]) = generate-id($nextComponent)]"/>
 
  49         <axsl:apply-templates select="following-sibling::*"/>
 
  53   <axsl:template match="dbk:para" mode="subsections">
 
  54     <axsl:param name="subsections" select="/.."/>
 
  56       <axsl:when test="@rnd:style = "bibliography" or @rnd:style = "bibliography-title"">
 
  57         <bibliography xmlns="http://docbook.org/ns/docbook">
 
  58           <axsl:call-template name="copy"/>
 
  59           <axsl:variable name="bibliodivs" select="following-sibling::dbk:para[@rnd:style = "bibliodiv" or @rnd:style = "bibliodiv-title"]"/>
 
  61             <axsl:when test="$bibliodivs">
 
  62               <axsl:apply-templates select="following-sibling::*[1]" mode="bibliodivs">
 
  63                 <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
 
  64                 <axsl:with-param name="bibliodivs" select="$bibliodivs[position() != 1]"/>
 
  65               </axsl:apply-templates>
 
  68               <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
 
  69                 <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
 
  70               </axsl:apply-templates>
 
  75       <axsl:when test="@rnd:style = "glossary" or @rnd:style = "glossary-title"">
 
  76         <glossary xmlns="http://docbook.org/ns/docbook">
 
  77           <axsl:call-template name="copy"/>
 
  78           <axsl:variable name="glossdivs" select="following-sibling::dbk:para[@rnd:style = "glossdiv" or @rnd:style = "glossdiv-title"]"/>
 
  80             <axsl:when test="$glossdivs">
 
  81               <axsl:apply-templates select="following-sibling::*[1]" mode="glossdivs">
 
  82                 <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
 
  83                 <axsl:with-param name="glossdivs" select="$glossdivs[position() != 1]"/>
 
  84               </axsl:apply-templates>
 
  87               <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
 
  88                 <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
 
  89               </axsl:apply-templates>
 
  94       <axsl:when test="@rnd:style = "qandaset" or @rnd:style = "qandaset-title"">
 
  95         <qandaset xmlns="http://docbook.org/ns/docbook">
 
  96           <axsl:call-template name="copy"/>
 
  97           <axsl:variable name="qandadivs" select="following-sibling::dbk:para[@rnd:style = "qandadiv" or @rnd:style = "qandadiv-title"]"/>
 
  99             <axsl:when test="$qandadivs">
 
 100               <axsl:apply-templates select="following-sibling::*[1]" mode="qandadivs">
 
 101                 <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
 
 102                 <axsl:with-param name="qandadivs" select="$qandadivs[position() != 1]"/>
 
 103               </axsl:apply-templates>
 
 106               <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
 
 107                 <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
 
 108               </axsl:apply-templates>
 
 115   <axsl:template match="*" mode="subsections">
 
 116     <axsl:param name="subsections" select="/.."/>
 
 118       <axsl:apply-templates select="@*"/>
 
 119       <axsl:apply-templates mode="subsections"/>
 
 122   <axsl:template match="dbk:para" mode="bibliodivs">
 
 123     <axsl:param name="nextSubsection" select="/.."/>
 
 124     <axsl:param name="bibliodivs" select="/.."/>
 
 126       <axsl:when test="generate-id() = generate-id($nextSubsection)"/>
 
 127       <axsl:when test="@rnd:style = "bibliodiv" or @rnd:style = "bibliodiv-title"">
 
 128         <bibliodiv xmlns="http://docbook.org/ns/docbook">
 
 129           <axsl:call-template name="copy"/>
 
 130           <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
 
 131             <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 132             <axsl:with-param name="nextbibliodiv" select="$bibliodivs[1]"/>
 
 133           </axsl:apply-templates>
 
 136           <axsl:when test="$nextSubsection and         $bibliodivs and         count($nextSubsection/preceding-sibling::* | $bibliodivs[1]) = count($nextSubsection/preceding-sibling::*)">
 
 137             <axsl:apply-templates select="$bibliodivs[1]" mode="bibliodivs">
 
 138               <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 139               <axsl:with-param name="bibliodivs" select="$bibliodivs[position() != 1]"/>
 
 140             </axsl:apply-templates>
 
 142           <axsl:when test="$bibliodivs">
 
 143             <axsl:apply-templates select="$bibliodivs[1]" mode="bibliodivs">
 
 144               <axsl:with-param name="bibliodivs" select="$bibliodivs[position() != 1]"/>
 
 145             </axsl:apply-templates>
 
 150         <axsl:call-template name="copy"/>
 
 151         <axsl:apply-templates select="following-sibling::*[1]" mode="bibliodivs">
 
 152           <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 153         </axsl:apply-templates>
 
 157   <axsl:template match="dbk:para" mode="glossdivs">
 
 158     <axsl:param name="nextSubsection" select="/.."/>
 
 159     <axsl:param name="glossdivs" select="/.."/>
 
 161       <axsl:when test="generate-id() = generate-id($nextSubsection)"/>
 
 162       <axsl:when test="@rnd:style = "glossdiv" or @rnd:style = "glossdiv-title"">
 
 163         <glossdiv xmlns="http://docbook.org/ns/docbook">
 
 164           <axsl:call-template name="copy"/>
 
 165           <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
 
 166             <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 167             <axsl:with-param name="nextglossdiv" select="$glossdivs[1]"/>
 
 168           </axsl:apply-templates>
 
 171           <axsl:when test="$nextSubsection and         $glossdivs and         count($nextSubsection/preceding-sibling::* | $glossdivs[1]) = count($nextSubsection/preceding-sibling::*)">
 
 172             <axsl:apply-templates select="$glossdivs[1]" mode="glossdivs">
 
 173               <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 174               <axsl:with-param name="glossdivs" select="$glossdivs[position() != 1]"/>
 
 175             </axsl:apply-templates>
 
 177           <axsl:when test="$glossdivs">
 
 178             <axsl:apply-templates select="$glossdivs[1]" mode="glossdivs">
 
 179               <axsl:with-param name="glossdivs" select="$glossdivs[position() != 1]"/>
 
 180             </axsl:apply-templates>
 
 185         <axsl:call-template name="copy"/>
 
 186         <axsl:apply-templates select="following-sibling::*[1]" mode="glossdivs">
 
 187           <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 188         </axsl:apply-templates>
 
 192   <axsl:template match="dbk:para" mode="qandadivs">
 
 193     <axsl:param name="nextSubsection" select="/.."/>
 
 194     <axsl:param name="qandadivs" select="/.."/>
 
 196       <axsl:when test="generate-id() = generate-id($nextSubsection)"/>
 
 197       <axsl:when test="@rnd:style = "qandadiv" or @rnd:style = "qandadiv-title"">
 
 198         <qandadiv xmlns="http://docbook.org/ns/docbook">
 
 199           <axsl:call-template name="copy"/>
 
 200           <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
 
 201             <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 202             <axsl:with-param name="nextqandadiv" select="$qandadivs[1]"/>
 
 203           </axsl:apply-templates>
 
 206           <axsl:when test="$nextSubsection and         $qandadivs and         count($nextSubsection/preceding-sibling::* | $qandadivs[1]) = count($nextSubsection/preceding-sibling::*)">
 
 207             <axsl:apply-templates select="$qandadivs[1]" mode="qandadivs">
 
 208               <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 209               <axsl:with-param name="qandadivs" select="$qandadivs[position() != 1]"/>
 
 210             </axsl:apply-templates>
 
 212           <axsl:when test="$qandadivs">
 
 213             <axsl:apply-templates select="$qandadivs[1]" mode="qandadivs">
 
 214               <axsl:with-param name="qandadivs" select="$qandadivs[position() != 1]"/>
 
 215             </axsl:apply-templates>
 
 220         <axsl:call-template name="copy"/>
 
 221         <axsl:apply-templates select="following-sibling::*[1]" mode="qandadivs">
 
 222           <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 223         </axsl:apply-templates>
 
 227   <axsl:template match="*" mode="terminal">
 
 228     <axsl:param name="nextSubsection" select="/.."/>
 
 229     <axsl:param name="nextbibliodiv" select="/.."/>
 
 230     <axsl:param name="nextglossdiv" select="/.."/>
 
 231     <axsl:param name="nextqandadiv" select="/.."/>
 
 233       <axsl:when test="generate-id() = generate-id($nextSubsection)"/>
 
 234       <axsl:when test="generate-id() = generate-id($nextbibliodiv)"/>
 
 235       <axsl:when test="generate-id() = generate-id($nextglossdiv)"/>
 
 236       <axsl:when test="generate-id() = generate-id($nextqandadiv)"/>
 
 238         <axsl:call-template name="copy"/>
 
 239         <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
 
 240           <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
 
 241           <axsl:with-param name="nextbibliodiv" select="$nextbibliodiv"/>
 
 242           <axsl:with-param name="nextglossdiv" select="$nextglossdiv"/>
 
 243           <axsl:with-param name="nextqandadiv" select="$nextqandadiv"/>
 
 244         </axsl:apply-templates>
 
 248   <axsl:template match="*">
 
 250       <axsl:apply-templates select="@*"/>
 
 251       <axsl:apply-templates/>
 
 254   <axsl:template name="copy">
 
 256       <axsl:apply-templates select="@*"/>
 
 257       <axsl:apply-templates/>
 
 260   <axsl:template match="@*">