--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE xsl:stylesheet [
+
+<!ENTITY para "w:p[w:pPr/w:pStyle[@w:val='para' or @w:val='Normal']]">
+<!ENTITY continue "w:p[w:pPr/w:pStyle/@w:val='para-continue']">
+
+<!ENTITY itemizedlist "w:p[w:pPr/w:pStyle[starts-with(@w:val,'itemizedlist')]]">
+<!ENTITY itemizedlist1 "w:p[w:pPr/w:pStyle[@w:val = 'itemizedlist']]">
+<!ENTITY orderedlist "w:p[w:pPr/w:pStyle[starts-with(@w:val,'orderedlist')]]">
+<!ENTITY orderedlist1 "w:p[w:pPr/w:pStyle[@w:val = 'orderedlist']]">
+
+<!ENTITY variablelist "w:tbl[w:tblPr/w:tblStyle[starts-with(@w:val,'variablelist')]]">
+
+<!ENTITY verbatim "w:p[w:pPr/w:pStyle[@w:val='programlisting' or @w:val='screen' or @w:val='literallayout']]">
+<!ENTITY admontitle "w:p[w:pPr/w:pStyle[@w:val='note-title' or @w:val='caution-title' or @w:val='important-title' or @w:val='tip-title' or @w:val='warning-title']]">
+<!ENTITY admon "w:p[w:pPr/w:pStyle[@w:val='note' or @w:val='caution' or @w:val='important' or @w:val='tip' or @w:val='warning']]">
+<!ENTITY figure "w:p[w:pPr/w:pStyle[@w:val='figure']]">
+<!ENTITY figuretitle "w:p[w:pPr/w:pStyle[@w:val='figuretitle']]">
+<!ENTITY figurecaption "w:p[w:pPr/w:pStyle[@w:val='figuretitle']]">
+<!ENTITY tabletitle "w:p[w:pPr/w:pStyle[@w:val='tabletitle']]">
+<!ENTITY exampletitle "w:p[w:pPr/w:pStyle[@w:val='exampletitle']]">
+<!ENTITY listlevel "substring-after(w:pPr/w:pStyle/@w:val, 'edlist')">
+<!ENTITY listlabel "w:pPr/w:listPr/wx:t/@wx:val">
+<!ENTITY footnote "w:p[w:pPr/w:pStyle[@w:val='FootnoteText']]">
+]>
+
+<xsl:stylesheet xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
+ xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
+ xmlns:v="urn:schemas-microsoft-com:vml"
+ xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
+ xmlns:o="urn:schemas-microsoft-com:office:office"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ exclude-result-prefixes="aml w wx o v" version="1.0">
+
+ <!-- $Id$ -->
+ <!-- Stylesheet to convert WordProcessingML to DocBook -->
+ <!-- This stylesheet processes the output of wordml-sects.xsl -->
+
+ <xsl:output indent="yes" method="xml"
+ doctype-public="-//OASIS//DTD DocBook XML V4.3//EN"
+ doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"/>
+
+ <!-- ================================================== -->
+ <!-- Parameters -->
+ <!-- ================================================== -->
+
+ <xsl:param name="nest.sections">1</xsl:param>
+
+ <!-- ================================================== -->
+ <!-- Templates -->
+ <!-- ================================================== -->
+ <!-- Look up a w:listDef element by its StyleLink -->
+ <xsl:key name="listdef-stylelink"
+ match="w:listDef"
+ use="w:listStyleLink/@w:val"/>
+
+ <xsl:key name="list-ilst"
+ match="w:list"
+ use="w:ilst/@w:val"/>
+
+ <xsl:strip-space elements='*'/>
+ <xsl:preserve-space elements='w:t'/>
+
+ <xsl:template match="/">
+ <xsl:apply-templates select="//w:body"/>
+ </xsl:template>
+
+ <xsl:template match="w:body">
+ <xsl:apply-templates mode="group"/>
+ </xsl:template>
+
+ <xsl:template match="wx:sect" mode="group">
+ <xsl:apply-templates mode="group"/>
+ </xsl:template>
+
+ <xsl:template match="wx:sub-section" mode="group">
+ <xsl:variable name="first.node" select="w:p[1]"/>
+ <xsl:variable name="style" select="$first.node/w:pPr/w:pStyle/@w:val"/>
+
+ <xsl:variable name="element.name">
+ <xsl:choose>
+ <xsl:when test="$style = 'article' or
+ $style = 'article-title'">article</xsl:when>
+ <xsl:when test="$style = 'appendix' or
+ $style = 'appendix-title'">appendix</xsl:when>
+ <xsl:when test="($style = 'sect1' or
+ $style = 'sect1-title') and
+ $nest.sections != 0">section</xsl:when>
+ <xsl:when test="$style = 'sect1' or
+ $style = 'sect1-title'">sect1</xsl:when>
+ <xsl:when test="($style = 'sect2' or
+ $style = 'sect2-title') and
+ $nest.sections != 0">section</xsl:when>
+ <xsl:when test="$style = 'sect2' or
+ $style = 'sect2-title'">sect2</xsl:when>
+ <xsl:when test="($style = 'sect3' or
+ $style = 'sect3-title') and
+ $nest.sections != 0">section</xsl:when>
+ <xsl:when test="$style = 'sect3' or
+ $style = 'sect3-title'">sect3</xsl:when>
+ <xsl:when test="($style = 'sect4' or
+ $style = 'sect4-title') and
+ $nest.sections != 0">section</xsl:when>
+ <xsl:when test="$style = 'sect4' or
+ $style = 'sect4-title'">sect4</xsl:when>
+ <xsl:when test="($style = 'sect5' or
+ $style = 'sect5-title') and
+ $nest.sections != 0">section</xsl:when>
+ <xsl:when test="$style = 'sect5' or
+ $style = 'sect5-title'">sect5</xsl:when>
+ <xsl:otherwise>bogus</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test='$element.name != "bogus"'>
+ <xsl:element name="{$element.name}">
+ <xsl:call-template name="object.id"/>
+ <xsl:apply-templates mode="group"/>
+ </xsl:element>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:apply-templates mode='group'/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+ <!-- sub-section title paragraph -->
+ <xsl:template match="wx:sub-section/w:p[1]" mode="group">
+ <title>
+ <xsl:apply-templates select="w:r|w:hlink"/>
+ </title>
+ </xsl:template>
+
+ <!-- Ordinary para -->
+ <xsl:template match="¶|w:p[not(w:pPr/w:pStyle)]" mode="group">
+ <para>
+ <xsl:call-template name="object.id"/>
+ <xsl:apply-templates select="w:r|w:hlink"/>
+ </para>
+ </xsl:template>
+
+ <!-- Unmatched para style -->
+ <xsl:template match="w:p" mode="group">
+ <nomatch>
+ <xsl:apply-templates select="w:r|w:hlink"/>
+ </nomatch>
+ </xsl:template>
+
+ <!-- unused elements are bypassed -->
+ <xsl:template match="*" mode="group"/>
+
+ <!-- continued paragraphs are included by their (preceding) parent -->
+ <xsl:template match="&continue;" mode='group'/>
+
+ <!-- Match on the first one of an itemizedlist -->
+ <xsl:template match="&itemizedlist1;[not(preceding-sibling::*[1]
+ [self::&itemizedlist; or self::&continue;])]"
+ priority="2"
+ mode="group">
+
+ <!-- Identify the node that follows all the listitems -->
+ <xsl:variable name="stop.node"
+ select="generate-id(following-sibling::*[not(self::&itemizedlist;
+ or self::&continue;
+ or self::&orderedlist;)][1])"/>
+
+ <!-- Start the list and process all the level 1 listitems -->
+ <itemizedlist>
+ <xsl:apply-templates mode="item"
+ select=".|following-sibling::&itemizedlist;[&listlevel; = '']
+ [following-sibling::*[generate-id() = $stop.node]]">
+ <xsl:with-param name="depth" select="1"/>
+ </xsl:apply-templates>
+ </itemizedlist>
+
+ </xsl:template>
+
+ <xsl:template match="&itemizedlist;" mode="item">
+ <xsl:param name="depth" select="1"/>
+
+ <listitem>
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ <xsl:apply-templates mode="item"
+ select="following-sibling::*[1][self::&continue;]"/>
+ <!-- Now any nested list is inside this list item -->
+ <xsl:apply-templates mode="subgroup"
+ select="following-sibling::*[1]
+ [self::&itemizedlist; or self::&orderedlist;]
+ [&listlevel; > $depth]">
+
+ <xsl:with-param name="depth" select="$depth + 1"/>
+ </xsl:apply-templates>
+ </listitem>
+
+ </xsl:template>
+
+<xsl:template match="&itemizedlist;" mode="subgroup">
+ <xsl:param name="depth" select="0"/>
+
+ <xsl:variable name="stop.node"
+ select="generate-id(following-sibling::*[
+ self::&itemizedlist1; or
+ self::&orderedlist1; or
+ self::&itemizedlist;[&listlevel; < $depth] or
+ self::&orderedlist;[&listlevel; < $depth] or
+ not(self::&itemizedlist; or
+ self::&orderedlist; or
+ self::&continue;)]
+ [1])"/>
+
+ <itemizedlist>
+ <xsl:apply-templates mode="item"
+ select=".|following-sibling::&itemizedlist;
+ [&listlevel; = $depth]
+ [following-sibling::*[generate-id() = $stop.node]]">
+ <xsl:with-param name="depth" select="$depth"/>
+ </xsl:apply-templates>
+ </itemizedlist>
+</xsl:template>
+
+<xsl:template match="&itemizedlist;[preceding-sibling::*[1]
+ [self::&itemizedlist; or
+ self::&orderedlist; or
+ self::&continue;]]"
+ mode="group">
+ <!-- Handle with mode = group -->
+</xsl:template>
+
+
+
+
+
+<!-- Match on the first one of an orderedlist -->
+<xsl:template match="&orderedlist1;[not(preceding-sibling::*[1]
+ [self::&orderedlist; or self::&continue;])]"
+ priority="2"
+ mode="group">
+
+ <!-- Identify the node that follows all the listitems -->
+ <xsl:variable name="stop.node"
+ select="generate-id(following-sibling::*[not(self::&itemizedlist;
+ or self::&continue;
+ or self::&orderedlist;)][1])"/>
+
+ <!-- Start the list and process all the level 1 listitems -->
+ <orderedlist>
+ <xsl:apply-templates mode="item"
+ select=".|following-sibling::&orderedlist;[&listlevel; = '']
+ [following-sibling::*[generate-id() = $stop.node]]">
+ <xsl:with-param name="depth" select="1"/>
+ </xsl:apply-templates>
+ </orderedlist>
+
+</xsl:template>
+
+<xsl:template match="&orderedlist;" mode="item">
+ <xsl:param name="depth" select="1"/>
+
+ <listitem>
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ <xsl:apply-templates mode="item"
+ select="following-sibling::*[1][self::&continue;]"/>
+ <!-- Now any nested list is inside this list item -->
+ <xsl:apply-templates mode="subgroup"
+ select="following-sibling::*[1]
+ [self::&itemizedlist; or self::&orderedlist;]
+ [&listlevel; > $depth]">
+
+ <xsl:with-param name="depth" select="$depth + 1"/>
+ </xsl:apply-templates>
+ </listitem>
+
+</xsl:template>
+
+<xsl:template match="&orderedlist;" mode="subgroup">
+ <xsl:param name="depth" select="0"/>
+
+ <xsl:variable name="stop.node"
+ select="generate-id(following-sibling::*[
+ self::&itemizedlist1; or
+ self::&orderedlist1; or
+ self::&itemizedlist;[&listlevel; < $depth] or
+ self::&orderedlist;[&listlevel; < $depth] or
+ not(self::&itemizedlist; or
+ self::&orderedlist; or
+ self::&continue;)]
+ [1])"/>
+
+ <orderedlist>
+ <xsl:apply-templates mode="item"
+ select=".|following-sibling::&orderedlist;
+ [&listlevel; = $depth]
+ [following-sibling::*[generate-id() = $stop.node]]">
+ <xsl:with-param name="depth" select="$depth"/>
+ </xsl:apply-templates>
+ </orderedlist>
+</xsl:template>
+
+<xsl:template match="&orderedlist;[preceding-sibling::*[1]
+ [self::&itemizedlist; or
+ self::&orderedlist; or
+ self::&continue;]]"
+ mode="group">
+ <!-- Handle with mode = group -->
+</xsl:template>
+
+<xsl:template match="&continue;" mode="item">
+ <para>
+ <xsl:call-template name="object.id"/>
+ <xsl:apply-templates select="w:r|w:hlink"/>
+ </para>
+ <!-- Continue to process any immediate following -->
+ <xsl:apply-templates mode="item"
+ select="following-sibling::*[1][self::&continue;]"/>
+</xsl:template>
+
+<xsl:template match="&continue;" mode="group">
+ <!-- Handled in item mode -->
+</xsl:template>
+
+<xsl:template match="*" mode="item">
+ <xsl:apply-templates/>
+</xsl:template>
+
+
+<!-- =========================================================== -->
+<!-- Inline elements -->
+<!-- =========================================================== -->
+<xsl:template match="w:hlink[w:r/w:rPr/w:rStyle[@w:val='link']]">
+ <link>
+ <xsl:attribute name="linkend"><xsl:value-of
+ select="@w:bookmark"/></xsl:attribute>
+ <xsl:apply-templates select="w:r"/>
+ </link>
+</xsl:template>
+
+<xsl:template match="w:hlink[w:r/w:rPr/w:rStyle[@w:val='ulink']]">
+ <ulink>
+ <xsl:attribute name="url"><xsl:value-of
+ select="@w:dest"/></xsl:attribute>
+ <xsl:apply-templates select="w:r"/>
+ </ulink>
+</xsl:template>
+
+<xsl:template match="w:hlink[w:r/w:rPr/w:rStyle[@w:val='olink']]">
+ <olink>
+ <xsl:attribute name="targetdoc"><xsl:value-of
+ select="@w:dest"/></xsl:attribute>
+ <xsl:attribute name="targetptr"><xsl:value-of
+ select="@w:bookmark"/></xsl:attribute>
+ <xsl:apply-templates select="w:r"/>
+ </olink>
+</xsl:template>
+
+<xsl:template match="w:hlink[w:r/w:rPr/w:rStyle[@w:val='xref']]">
+ <xref>
+ <xsl:attribute name="linkend"><xsl:value-of
+ select="@w:bookmark"/></xsl:attribute>
+ </xref>
+</xsl:template>
+
+<xsl:template match="w:r[w:rPr/w:rStyle[@w:val = 'emphasis']]">
+ <emphasis>
+ <xsl:apply-templates select="w:t"/>
+ </emphasis>
+</xsl:template>
+
+<xsl:template match="w:r[w:rPr/w:rStyle[@w:val = 'FootnoteReference']]">
+ <footnote>
+ <xsl:apply-templates/>
+ </footnote>
+</xsl:template>
+
+<!-- Ignore the footnote number with the footnote text -->
+<xsl:template match="w:r[w:rPr/w:rStyle[@w:val = 'FootnoteReference']]
+ [child::w:footnoteRef]">
+</xsl:template>
+
+<xsl:template match="w:footnote">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<!-- The footnote text -->
+<xsl:template match="&footnote;">
+ <para>
+ <xsl:apply-templates/>
+ </para>
+</xsl:template>
+
+<xsl:template match="w:r">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="w:t">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template name="object.id">
+ <xsl:variable name="id">
+ <xsl:apply-templates select="." mode="object.id"/>
+ </xsl:variable>
+ <xsl:if test="$id != ''">
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="w:p" mode="object.id">
+
+ <xsl:variable name="bookmark.inside">
+ <xsl:value-of select="aml:annotation
+ [@w:type = 'Word.Bookmark.Start'][1]/@w:name"/>
+ </xsl:variable>
+
+ <xsl:variable name="bookmark.preceding">
+ <xsl:value-of select="preceding-sibling::*[2]
+ [self::aml:annotation
+ [@w:type = 'Word.Bookmark.Start']
+ [following-sibling::aml:annotation
+ [@w:type = 'Word.Bookmark.End']]]
+ /@w:name"/>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$bookmark.inside != ''">
+ <xsl:value-of select="$bookmark.inside"/>
+ </xsl:when>
+ <xsl:when test="$bookmark.preceding != ''">
+ <xsl:value-of select="$bookmark.preceding"/>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template match="wx:sub-section" mode="object.id">
+ <!-- First para has the bookmark -->
+ <xsl:value-of select="w:p[1]/aml:annotation
+ [@w:type = 'Word.Bookmark.Start'][1]/@w:name"/>
+</xsl:template>
+
+<!-- Index entry -->
+<xsl:template match="w:r/w:instrText">
+ <xsl:variable name="text" select="normalize-space(.)"/>
+
+ <xsl:choose>
+ <xsl:when test="starts-with($text, 'XE')">
+
+ <xsl:variable name="primary">
+ <xsl:choose>
+ <xsl:when test="contains($text, ':')">
+ <xsl:value-of select="substring-before(
+ substring-after($text, 'XE "'), ':')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(
+ substring-after($text, 'XE "'), '"')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="secondary">
+ <xsl:choose>
+ <xsl:when test="contains($text, ':')">
+ <xsl:value-of select="substring-before(
+ substring-after($text, ':'), '"')"/>
+ </xsl:when>
+ <xsl:otherwise></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <indexterm>
+ <primary><xsl:value-of select="$primary"/></primary>
+ <xsl:if test="$secondary != ''">
+ <secondary><xsl:value-of select="$secondary"/></secondary>
+ </xsl:if>
+ </indexterm>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template match="&figure;" mode="group">
+
+ <!-- Get title and caption from siblings -->
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="following-sibling::*[1][self::&figuretitle;]">
+ <xsl:apply-templates
+ mode="figuretitle"
+ select="following-sibling::*[1][self::&figuretitle;]"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::*[1][self::&figuretitle;]">
+ <xsl:apply-templates
+ mode="figuretitle"
+ select="preceding-sibling::*[1][self::&figuretitle;]"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- FIXME -->
+ <xsl:variable name="caption"/>
+
+ <xsl:variable name="shape" select="w:r/w:pict/v:shape"/>
+ <xsl:variable name="style" select="$shape/@style"/>
+
+ <xsl:variable name="src" select="$shape/v:imagedata/@src"/>
+ <xsl:variable name="width"
+ select="substring-before(
+ substring-after($style, 'width:'), ';')"/>
+ <xsl:variable name="height">
+ <xsl:variable name="candidate"
+ select="substring-before(
+ substring-after($style, 'height:'), ';') != ''"/>
+ <xsl:choose>
+ <xsl:when test="$candidate != ''">
+ <xsl:value-of select="$candidate"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($style, 'height:')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="element">
+ <xsl:choose>
+ <xsl:when test="$title != ''">figure</xsl:when>
+ <xsl:otherwise>informalfigure</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$element}">
+ <xsl:call-template name="object.id"/>
+ <xsl:if test="$title != ''">
+ <title>
+ <xsl:copy-of select="$title"/>
+ </title>
+ </xsl:if>
+ <mediaobject>
+ <imageobject>
+ <imagedata>
+ <xsl:attribute name="fileref">
+ <xsl:value-of select="$src"/>
+ </xsl:attribute>
+ <xsl:if test="$width != ''">
+ <xsl:attribute name="contentwidth">
+ <xsl:value-of select="$width"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$height != ''">
+ <xsl:attribute name="contentdepth">
+ <xsl:value-of select="$height"/>
+ </xsl:attribute>
+ </xsl:if>
+ </imagedata>
+ </imageobject>
+ </mediaobject>
+ </xsl:element>
+
+</xsl:template>
+
+<xsl:template match="&figuretitle;" mode="group"/>
+
+<xsl:template match="&figuretitle;" mode="figuretitle">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="&exampletitle;" mode="group">
+ <example>
+ <title>
+ <xsl:apply-templates/>
+ </title>
+ <xsl:apply-templates mode="example"
+ select="following-sibling::*[1][self::w:p or self::w:tbl]" />
+ </example>
+</xsl:template>
+
+
+<!-- Process tables -->
+<xsl:template match="w:tbl" mode="group">
+
+ <!-- Get title and caption from siblings -->
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="following-sibling::*[1][self::&tabletitle;]">
+ <xsl:apply-templates
+ mode="tabletitle"
+ select="following-sibling::*[1][self::&tabletitle;]"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::*[1][self::&tabletitle;]">
+ <xsl:apply-templates
+ mode="tabletitle"
+ select="preceding-sibling::*[1][self::&tabletitle;]"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- FIXME -->
+ <xsl:variable name="caption"/>
+
+ <xsl:variable name="element">
+ <xsl:choose>
+ <xsl:when test="$title != ''">table</xsl:when>
+ <xsl:otherwise>informaltable</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$element}">
+ <xsl:call-template name="object.id"/>
+ <xsl:if test="$title != ''">
+ <title>
+ <xsl:copy-of select="$title"/>
+ </title>
+ </xsl:if>
+
+ <tgroup>
+ <xsl:attribute name="cols">
+ <xsl:value-of select="count(w:tblGrid/w:gridCol)"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="w:tblGrid" mode="colspec"/>
+ <xsl:if test="w:tr[descendant::w:pStyle[@w:val = 'tableheader']]">
+ <thead>
+ <xsl:apply-templates mode="tableheader"
+ select="w:tr[descendant::w:pStyle[@w:val = 'tableheader']]"/>
+ </thead>
+ </xsl:if>
+ <tbody>
+ <xsl:apply-templates/>
+ </tbody>
+ </tgroup>
+
+ </xsl:element>
+
+</xsl:template>
+
+<xsl:template match="&tabletitle;" mode="group"/>
+
+<xsl:template match="&tabletitle;" mode="tabletitle">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="w:tblGrid" mode="colspec">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="w:tblGrid">
+</xsl:template>
+
+<xsl:template match="w:tblGrid/w:gridCol">
+ <colspec>
+ <xsl:attribute name="colnum">
+ <xsl:value-of select="position()"/>
+ </xsl:attribute>
+ <xsl:attribute name="colname">
+ <xsl:value-of select="concat('col', position())"/>
+ </xsl:attribute>
+ <xsl:if test="@w:w != ''">
+ <xsl:variable name="calcwidth">
+ <xsl:value-of select="@w:w div 20"/>
+ </xsl:variable>
+ <xsl:attribute name="colwidth">
+ <xsl:value-of select="concat($calcwidth, 'pt')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </colspec>
+</xsl:template>
+
+<!-- Table header row -->
+<xsl:template mode="tableheader"
+ match="w:tr[descendant::w:pStyle[@w:val = 'tableheader']]">
+ <row>
+ <xsl:apply-templates/>
+ </row>
+</xsl:template>
+
+<xsl:template match="w:tr[descendant::w:pStyle[@w:val = 'tableheader']]">
+ <!-- Already handled in tableheader mode -->
+</xsl:template>
+
+<xsl:template match="w:tr">
+ <row>
+ <xsl:apply-templates/>
+ </row>
+</xsl:template>
+
+<xsl:template match="w:tc">
+ <entry>
+ <!-- Process any spans -->
+ <xsl:call-template name="cell.span"/>
+ <!-- Process as paras if more than one w:p in the cell -->
+ <xsl:choose>
+ <xsl:when test="count(w:p) = 1">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="group"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </entry>
+</xsl:template>
+
+<xsl:template name="cell.span">
+ <xsl:variable name="span" select="0 + w:tcPr/w:gridSpan/@w:val"/>
+ <xsl:if test="$span > 0">
+ <!-- Get the current cell number -->
+ <xsl:variable name="colstart">
+ <xsl:call-template name="colcount">
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="namest"><xsl:value-of
+ select="concat('col', $colstart)"/></xsl:attribute>
+ <xsl:attribute name="nameend"><xsl:value-of
+ select="concat('col', $colstart + $span - 1)"/></xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<!-- recursively count preceding columns, including spans -->
+<xsl:template name="colcount">
+ <xsl:param name="count" select="0"/>
+ <xsl:param name="cell" select="."/>
+ <xsl:choose>
+ <xsl:when test="$cell/preceding-sibling::w:tc">
+ <xsl:variable name="span"
+ select="0 + $cell/preceding-sibling::w:tc/w:tcPr/w:gridSpan/@w:val"/>
+ <xsl:choose>
+ <xsl:when test="$span > 0">
+ <xsl:call-template name="colcount">
+ <xsl:with-param name="count" select="$count + $span"/>
+ <xsl:with-param name="cell" select="$cell/preceding-sibling::w:tc"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="colcount">
+ <xsl:with-param name="count" select="$count + 1"/>
+ <xsl:with-param name="cell" select="$cell/preceding-sibling::w:tc"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$count"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!--
+<xsl:template match="w:p[w:pPr/w:pStyle[@w:val = 'tableheader']]">
+ <para>
+ <xsl:call-template name="object.id"/>
+ <xsl:apply-templates select="w:r|w:hlink"/>
+ </para>
+</xsl:template>
+-->
+
+<!-- variablelist is a two-column table with table style='variablelist' -->
+<xsl:template match="&variablelist;" mode="group">
+ <variablelist>
+ <xsl:call-template name="object.id"/>
+ <xsl:apply-templates select="w:tr" mode="variablelist"/>
+ </variablelist>
+</xsl:template>
+
+<xsl:template match="w:tr" mode="variablelist">
+ <varlistentry>
+ <term>
+ <xsl:apply-templates select="w:tc[1]/*" mode="variablelist.term"/>
+ </term>
+ <listitem>
+ <xsl:apply-templates select="w:tc[2]/*" mode="group"/>
+ </listitem>
+ </varlistentry>
+</xsl:template>
+
+<!-- No para tags inside variablelist term -->
+<xsl:template match="w:p" mode="variablelist.term">
+ <xsl:apply-templates select="w:r|w:hlink"/>
+</xsl:template>
+
+<xsl:template match='&admontitle;' mode='group'>
+ <xsl:variable name='element.name'
+ select='substring-before(w:pPr/w:pStyle/@w:val, "-title")'/>
+
+ <xsl:element name='{$element.name}'>
+ <xsl:call-template name='object.id'/>
+ <title>
+ <xsl:apply-templates select='w:r|w:hlink'/>
+ </title>
+
+ <!-- Identify the node that follows all admonitions of the same type -->
+ <xsl:variable name='stop.node'
+ select='generate-id(following-sibling::w:p[w:p/w:pStyle/@w:val != $element.name][1])'/>
+
+ <xsl:choose>
+ <xsl:when test='$stop.node'>
+ <xsl:apply-templates
+ select='following-sibling::w:p[w:p/w:pStyle/@w:val = $element.name]
+ [generate-id(following-sibling::w:p[w:p/w:pStyle/@w:val != $element.name][1]) = $stop.node]' mode='continue'/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select='following-sibling::*' mode='continue'>
+ <xsl:with-param name='styles' select='concat(" ", $element.name, " para-continue ")'/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+</xsl:template>
+
+<!-- Handle admonitions without a title -->
+<xsl:template match="&admon;" mode="group">
+ <xsl:variable name="element.name" select="w:pPr/w:pStyle/@w:val"/>
+
+ <xsl:variable name='title.node'
+ select='preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = concat($element.name, "-title")][1]'/>
+ <xsl:variable name='stop.node'
+ select='preceding-sibling::w:p[w:pPr/w:pStyle/@w:val != concat($element.name, "-title")][1]'/>
+
+ <xsl:choose>
+ <xsl:when test='preceding-sibling::*[1]/self::w:p[w:pPr/w:pStyle/@w:val = $element.name or w:pPr/w:pStyle/@w:val = "para-continue"]'/>
+ <xsl:when test='$title.node and $stop.node and
+ count($title.node|$stop.node/preceding-sibling::*) = count($stop.node/preceding-sibling::*)'>
+ <!-- The previous title is not related to this node -->
+ <xsl:call-template name='make-admonition'>
+ <xsl:with-param name='element.name' select='$element.name'/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- The title node has included this node -->
+ <xsl:when test='$title.node'/>
+
+ <xsl:otherwise>
+ <xsl:call-template name='make-admonition'>
+ <xsl:with-param name='element.name' select='$element.name'/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+<xsl:template name='make-admonition'>
+ <xsl:param name='element.name'/>
+
+ <xsl:element name="{$element.name}">
+ <xsl:call-template name="object.id"/>
+ <para>
+ <xsl:apply-templates select="w:r|w:hlink"/>
+ </para>
+ <xsl:apply-templates mode="continue"
+ select="following-sibling::*[1]">
+ <xsl:with-param name='styles' select='concat(" ", $element.name, " para-continue ")'/>
+ </xsl:apply-templates>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="w:p" mode="continue">
+ <xsl:param name='styles' select='" para-continue "'/>
+
+ <xsl:if test='contains($styles, concat(" ", w:pPr/w:pStyle/@w:val, " "))'>
+ <para>
+ <xsl:call-template name="object.id"/>
+ <xsl:apply-templates select="w:r|w:hlink"/>
+ </para>
+ <!-- Continue to process any immediate following -->
+ <xsl:apply-templates mode="continue"
+ select="following-sibling::*[1]">
+ <xsl:with-param name='styles' select='$styles'/>
+ </xsl:apply-templates>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="&verbatim;[not(preceding-sibling::*[1]
+ [self::&verbatim;])]"
+ mode="group">
+
+ <xsl:variable name="element.name" select="w:pPr/w:pStyle/@w:val"/>
+ <!-- Start the listing and process all subsequent ones too -->
+ <xsl:element name="{$element.name}">
+ <xsl:call-template name="object.id"/>
+ <xsl:apply-templates select="." mode="item"/>
+ </xsl:element>
+
+</xsl:template>
+
+<xsl:template match="&verbatim;[not(preceding-sibling::*[1]
+ [self::&verbatim;])]"
+ mode="example">
+
+ <xsl:variable name="element.name" select="w:pPr/w:pStyle/@w:val"/>
+ <!-- Start the listing and process all subsequent ones too -->
+ <xsl:element name="{$element.name}">
+ <xsl:call-template name="object.id"/>
+ <xsl:apply-templates select="." mode="item"/>
+ </xsl:element>
+
+</xsl:template>
+
+
+<xsl:template match="&verbatim;[preceding-sibling::*[1]
+ [self::&verbatim;]]"
+ mode="group">
+ <!-- Non-first verbatims are handled in item mode -->
+</xsl:template>
+
+<xsl:template match="&verbatim;" mode="item">
+
+ <xsl:apply-templates select="w:r|w:hlink" />
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="following-sibling::*[1][self::&verbatim;]"
+ mode="item"/>
+</xsl:template>
+
+<xsl:template match="w:br[ancestor::&verbatim;]">
+ <xsl:text>
</xsl:text>
+</xsl:template>
+
+<xsl:template match="&verbatim;[preceding-sibling::*[1]
+ [self::&exampletitle;]]"
+ priority="2"
+ mode="group"/>
+
+<xsl:template match="w:tbl[preceding-sibling::*[1][self::&exampletitle;]]"
+ priority="2"
+ mode="group"/>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" version="1.0">
+<!--====================================-->
+<!--= =-->
+<!--= DO NOT EDIT THIS STYLESHEET =-->
+<!--= =-->
+<!--= This stylesheet is generated =-->
+<!--= by makeSections.xsl and a =-->
+<!--= mapping specification. =-->
+<!--= =-->
+<!--= Revision history: =-->
+<!--= 1.1 2004-12-08 SRB =-->
+<!--= Implement multiple elements... =-->
+<!--= 1.0.1 2004-12-01 SRB =-->
+<!--= Fixed missing sections. =-->
+<!--= =-->
+<!--= $Id$ =-->
+<!--= =-->
+<!--====================================-->
+ <axsl:output indent="yes" encoding="utf-8"/>
+ <axsl:strip-space elements="*"/>
+ <axsl:preserve-space elements="w:t"/>
+ <axsl:template match="w:body">
+ <axsl:copy>
+ <axsl:for-each select="@*">
+ <axsl:copy/>
+ </axsl:for-each>
+ <axsl:variable name="books" select="w:p[w:pPr/w:pStyle/@w:val = "book" or w:pPr/w:pStyle/@w:val = "book-title"]"/>
+ <axsl:variable name="toplevel-components" select="w:p[w:pPr/w:pStyle/@w:val = "article" or w:pPr/w:pStyle/@w:val = "article-title" or w:pPr/w:pStyle/@w:val = "appendix" or w:pPr/w:pStyle/@w:val = "appendix-title" or w:pPr/w:pStyle/@w:val = "chapter" or w:pPr/w:pStyle/@w:val = "chapter-title" or w:pPr/w:pStyle/@w:val = "preface" or w:pPr/w:pStyle/@w:val = "preface-title"]"/>
+ <axsl:variable name="glossarys" select="w:p[w:pPr/w:pStyle/@w:val = "glossary" or w:pPr/w:pStyle/@w:val = "glossary-title"]"/>
+ <axsl:variable name="bibliographys" select="w:p[w:pPr/w:pStyle/@w:val = "bibliography" or w:pPr/w:pStyle/@w:val = "bibliography-title"]"/>
+ <axsl:choose>
+ <axsl:when test="$books">
+ <axsl:apply-templates select="$books[1]/preceding-sibling::*"/>
+ <axsl:apply-templates select="$books[1]" mode="book">
+ <axsl:with-param name="books" select="$books[position() != 1]"/>
+ </axsl:apply-templates>
+ </axsl:when>
+ <axsl:when test="$toplevel-components">
+ <axsl:apply-templates select="$toplevel-components[1]/preceding-sibling::*"/>
+ <axsl:apply-templates select="$toplevel-components[1]" mode="toplevel-component">
+ <axsl:with-param name="toplevel-components" select="$toplevel-components[position() != 1]"/>
+ </axsl:apply-templates>
+ </axsl:when>
+ <axsl:when test="$glossarys">
+ <axsl:apply-templates select="$glossarys[1]/preceding-sibling::*"/>
+ <axsl:apply-templates select="$glossarys[1]" mode="glossary">
+ <axsl:with-param name="glossarys" select="$glossarys[position() != 1]"/>
+ </axsl:apply-templates>
+ </axsl:when>
+ <axsl:when test="$bibliographys">
+ <axsl:apply-templates select="$bibliographys[1]/preceding-sibling::*"/>
+ <axsl:apply-templates select="$bibliographys[1]" mode="bibliography">
+ <axsl:with-param name="bibliographys" select="$bibliographys[position() != 1]"/>
+ </axsl:apply-templates>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:apply-templates/>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:copy>
+ </axsl:template>
+ <axsl:template match="w:p" mode="book">
+ <axsl:param name="books" select="/.."/>
+ <axsl:choose>
+ <axsl:when test="$books and (w:pPr/w:pStyle/@w:val = "book" or w:pPr/w:pStyle/@w:val = "book-title")">
+ <axsl:call-template name="make-book">
+ <axsl:with-param name="books" select="$books"/>
+ <axsl:with-param name="book-components" select="$books[1]/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "article" or w:pPr/w:pStyle/@w:val = "article-title" or w:pPr/w:pStyle/@w:val = "appendix" or w:pPr/w:pStyle/@w:val = "appendix-title" or w:pPr/w:pStyle/@w:val = "chapter" or w:pPr/w:pStyle/@w:val = "chapter-title" or w:pPr/w:pStyle/@w:val = "preface" or w:pPr/w:pStyle/@w:val = "preface-title"]"/>
+ </axsl:call-template>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="make-book">
+ <axsl:with-param name="books" select="$books"/>
+ <axsl:with-param name="book-components" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "article" or w:pPr/w:pStyle/@w:val = "article-title" or w:pPr/w:pStyle/@w:val = "appendix" or w:pPr/w:pStyle/@w:val = "appendix-title" or w:pPr/w:pStyle/@w:val = "chapter" or w:pPr/w:pStyle/@w:val = "chapter-title" or w:pPr/w:pStyle/@w:val = "preface" or w:pPr/w:pStyle/@w:val = "preface-title"]"/>
+ </axsl:call-template>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template name="make-book">
+ <axsl:param name="books" select="/.."/>
+ <axsl:param name="book-components" select="/.."/>
+ <wx:sub-section class="book">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-component">
+ <axsl:with-param name="nextbook" select="$books[1]"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:apply-templates select="$books[1]" mode="book">
+ <axsl:with-param name="books" select="$books[position() != 1]"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="w:p" mode="toplevel-component">
+ <axsl:param name="toplevel-components" select="/.."/>
+ <axsl:choose>
+ <axsl:when test="$toplevel-components and (w:pPr/w:pStyle/@w:val = "article" or w:pPr/w:pStyle/@w:val = "article-title" or w:pPr/w:pStyle/@w:val = "appendix" or w:pPr/w:pStyle/@w:val = "appendix-title" or w:pPr/w:pStyle/@w:val = "chapter" or w:pPr/w:pStyle/@w:val = "chapter-title" or w:pPr/w:pStyle/@w:val = "preface" or w:pPr/w:pStyle/@w:val = "preface-title")">
+ <axsl:call-template name="make-toplevel-component">
+ <axsl:with-param name="toplevel-components" select="$toplevel-components"/>
+ <axsl:with-param name="sect1s" select="$toplevel-components[1]/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect1" or w:pPr/w:pStyle/@w:val = "sect1-title"]"/>
+ </axsl:call-template>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="make-toplevel-component">
+ <axsl:with-param name="toplevel-components" select="$toplevel-components"/>
+ <axsl:with-param name="sect1s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect1" or w:pPr/w:pStyle/@w:val = "sect1-title"]"/>
+ </axsl:call-template>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template name="make-toplevel-component">
+ <axsl:param name="toplevel-components" select="/.."/>
+ <axsl:param name="sect1s" select="/.."/>
+ <wx:sub-section class="toplevel-component">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect1">
+ <axsl:with-param name="nexttoplevel-component" select="$toplevel-components[1]"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:apply-templates select="$toplevel-components[1]" mode="toplevel-component">
+ <axsl:with-param name="toplevel-components" select="$toplevel-components[position() != 1]"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="w:p" mode="glossary">
+ <axsl:param name="glossarys" select="/.."/>
+ <axsl:choose>
+ <axsl:when test="$glossarys and (w:pPr/w:pStyle/@w:val = "glossary" or w:pPr/w:pStyle/@w:val = "glossary-title")">
+ <axsl:call-template name="make-glossary">
+ <axsl:with-param name="glossarys" select="$glossarys"/>
+ <axsl:with-param name="glossdivs" select="$glossarys[1]/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "glossdiv" or w:pPr/w:pStyle/@w:val = "glossdiv-title"]"/>
+ </axsl:call-template>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="make-glossary">
+ <axsl:with-param name="glossarys" select="$glossarys"/>
+ <axsl:with-param name="glossdivs" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "glossdiv" or w:pPr/w:pStyle/@w:val = "glossdiv-title"]"/>
+ </axsl:call-template>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template name="make-glossary">
+ <axsl:param name="glossarys" select="/.."/>
+ <axsl:param name="glossdivs" select="/.."/>
+ <wx:sub-section class="glossary">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="glossary-glossdiv">
+ <axsl:with-param name="nextglossary" select="$glossarys[1]"/>
+ <axsl:with-param name="glossdivs" select="$glossdivs"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:apply-templates select="$glossarys[1]" mode="glossary">
+ <axsl:with-param name="glossarys" select="$glossarys[position() != 1]"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="w:p" mode="bibliography">
+ <axsl:param name="bibliographys" select="/.."/>
+ <axsl:choose>
+ <axsl:when test="$bibliographys and (w:pPr/w:pStyle/@w:val = "bibliography" or w:pPr/w:pStyle/@w:val = "bibliography-title")">
+ <axsl:call-template name="make-bibliography">
+ <axsl:with-param name="bibliographys" select="$bibliographys"/>
+ <axsl:with-param name="bibliodivs" select="$bibliographys[1]/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "bibliodiv" or w:pPr/w:pStyle/@w:val = "bibliodiv-title"]"/>
+ </axsl:call-template>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="make-bibliography">
+ <axsl:with-param name="bibliographys" select="$bibliographys"/>
+ <axsl:with-param name="bibliodivs" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "bibliodiv" or w:pPr/w:pStyle/@w:val = "bibliodiv-title"]"/>
+ </axsl:call-template>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template name="make-bibliography">
+ <axsl:param name="bibliographys" select="/.."/>
+ <axsl:param name="bibliodivs" select="/.."/>
+ <wx:sub-section class="bibliography">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="bibliography-bibliodiv">
+ <axsl:with-param name="nextbibliography" select="$bibliographys[1]"/>
+ <axsl:with-param name="bibliodivs" select="$bibliodivs"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:apply-templates select="$bibliographys[1]" mode="bibliography">
+ <axsl:with-param name="bibliographys" select="$bibliographys[position() != 1]"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="w:p" mode="book-component">
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextbook)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "article" or w:pPr/w:pStyle/@w:val = "article-title" or w:pPr/w:pStyle/@w:val = "appendix" or w:pPr/w:pStyle/@w:val = "appendix-title" or w:pPr/w:pStyle/@w:val = "chapter" or w:pPr/w:pStyle/@w:val = "chapter-title" or w:pPr/w:pStyle/@w:val = "preface" or w:pPr/w:pStyle/@w:val = "preface-title"">
+ <axsl:variable name="nextbook-component" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "article" or w:pPr/w:pStyle/@w:val = "article-title" or w:pPr/w:pStyle/@w:val = "appendix" or w:pPr/w:pStyle/@w:val = "appendix-title" or w:pPr/w:pStyle/@w:val = "chapter" or w:pPr/w:pStyle/@w:val = "chapter-title" or w:pPr/w:pStyle/@w:val = "preface" or w:pPr/w:pStyle/@w:val = "preface-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextbook-component">
+ <axsl:variable name="sect1s" select="$nextbook-component/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect1" or w:pPr/w:pStyle/@w:val = "sect1-title"]"/>
+ <wx:sub-section class="book-component">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect1">
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="count($book-components|$nextbook-component) = count($book-components)">
+ <axsl:apply-templates select="$nextbook-component" mode="book-component">
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect1s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect1" or w:pPr/w:pStyle/@w:val = "sect1-title"]"/>
+ <wx:sub-section class="book-component">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect1">
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="count($book-components|$nextbook-component) = count($book-components)">
+ <axsl:apply-templates select="$nextbook-component" mode="book-component">
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-component">
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="book-sect1">
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextbook-component)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect1" or w:pPr/w:pStyle/@w:val = "sect1-title"">
+ <axsl:variable name="nextsect1" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect1" or w:pPr/w:pStyle/@w:val = "sect1-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextsect1">
+ <axsl:variable name="sect2s" select="$nextsect1/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect2" or w:pPr/w:pStyle/@w:val = "sect2-title"]"/>
+ <wx:sub-section class="sect1">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect1 and (not($book-components) or count($sect1s|$nextsect1) = count($sect1s))">
+ <axsl:apply-templates select="$nextsect1" mode="book-sect1">
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect2s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect2" or w:pPr/w:pStyle/@w:val = "sect2-title"]"/>
+ <wx:sub-section class="sect1">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect1 and (not($book-components) or count($sect1s|$nextsect1) = count($sect1s))">
+ <axsl:apply-templates select="$nextsect1" mode="book-sect1">
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect1">
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="book-sect2">
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook-component)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect2" or w:pPr/w:pStyle/@w:val = "sect2-title"">
+ <axsl:variable name="nextsect2" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect2" or w:pPr/w:pStyle/@w:val = "sect2-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextsect2">
+ <axsl:variable name="sect3s" select="$nextsect2/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect3" or w:pPr/w:pStyle/@w:val = "sect3-title"]"/>
+ <wx:sub-section class="sect2">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect2 and (not($sect1s) or count($sect2s|$nextsect2) = count($sect2s))">
+ <axsl:apply-templates select="$nextsect2" mode="book-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect3s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect3" or w:pPr/w:pStyle/@w:val = "sect3-title"]"/>
+ <wx:sub-section class="sect2">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect2 and (not($sect1s) or count($sect2s|$nextsect2) = count($sect2s))">
+ <axsl:apply-templates select="$nextsect2" mode="book-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="book-sect3">
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect2)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook-component)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect3" or w:pPr/w:pStyle/@w:val = "sect3-title"">
+ <axsl:variable name="nextsect3" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect3" or w:pPr/w:pStyle/@w:val = "sect3-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextsect3">
+ <axsl:variable name="sect4s" select="$nextsect3/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect4" or w:pPr/w:pStyle/@w:val = "sect4-title"]"/>
+ <wx:sub-section class="sect3">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect3 and (not($sect2s) or count($sect3s|$nextsect3) = count($sect3s))">
+ <axsl:apply-templates select="$nextsect3" mode="book-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect4s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect4" or w:pPr/w:pStyle/@w:val = "sect4-title"]"/>
+ <wx:sub-section class="sect3">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect3 and (not($sect2s) or count($sect3s|$nextsect3) = count($sect3s))">
+ <axsl:apply-templates select="$nextsect3" mode="book-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="book-sect4">
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect3)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect2)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook-component)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect4" or w:pPr/w:pStyle/@w:val = "sect4-title"">
+ <axsl:variable name="nextsect4" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect4" or w:pPr/w:pStyle/@w:val = "sect4-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextsect4">
+ <axsl:variable name="sect5s" select="$nextsect4/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect5" or w:pPr/w:pStyle/@w:val = "sect5-title"]"/>
+ <wx:sub-section class="sect4">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect4 and (not($sect3s) or count($sect4s|$nextsect4) = count($sect4s))">
+ <axsl:apply-templates select="$nextsect4" mode="book-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect5s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect5" or w:pPr/w:pStyle/@w:val = "sect5-title"]"/>
+ <wx:sub-section class="sect4">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect4 and (not($sect3s) or count($sect4s|$nextsect4) = count($sect4s))">
+ <axsl:apply-templates select="$nextsect4" mode="book-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="book-sect5">
+ <axsl:param name="nextsect4" select="/.."/>
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect5s"/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect4)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect3)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect2)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook-component)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect5" or w:pPr/w:pStyle/@w:val = "sect5-title"">
+ <axsl:variable name="nextsect5" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect5" or w:pPr/w:pStyle/@w:val = "sect5-title"][1]"/>
+ <wx:sub-section class="sect5">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-terminal">
+ <axsl:with-param name="nextsect5" select="$nextsect5"/>
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect5 and (not($sect4s) or count($sect5s|$nextsect5) = count($sect5s))">
+ <axsl:apply-templates select="$nextsect5" mode="book-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="toplevel-sect1">
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nexttoplevel-component)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect1" or w:pPr/w:pStyle/@w:val = "sect1-title"">
+ <axsl:variable name="nextsect1" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect1" or w:pPr/w:pStyle/@w:val = "sect1-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextsect1">
+ <axsl:variable name="sect2s" select="$nextsect1/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect2" or w:pPr/w:pStyle/@w:val = "sect2-title"]"/>
+ <wx:sub-section class="sect1">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="count($sect1s|$nextsect1) = count($sect1s)">
+ <axsl:apply-templates select="$nextsect1" mode="toplevel-sect1">
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect2s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect2" or w:pPr/w:pStyle/@w:val = "sect2-title"]"/>
+ <wx:sub-section class="sect1">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="count($sect1s|$nextsect1) = count($sect1s)">
+ <axsl:apply-templates select="$nextsect1" mode="toplevel-sect1">
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect1">
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="toplevel-sect2">
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nexttoplevel-component)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect2" or w:pPr/w:pStyle/@w:val = "sect2-title"">
+ <axsl:variable name="nextsect2" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect2" or w:pPr/w:pStyle/@w:val = "sect2-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextsect2">
+ <axsl:variable name="sect3s" select="$nextsect2/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect3" or w:pPr/w:pStyle/@w:val = "sect3-title"]"/>
+ <wx:sub-section class="sect2">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect2 and (not($sect1s) or count($sect2s|$nextsect2) = count($sect2s))">
+ <axsl:apply-templates select="$nextsect2" mode="toplevel-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect3s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect3" or w:pPr/w:pStyle/@w:val = "sect3-title"]"/>
+ <wx:sub-section class="sect2">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect2 and (not($sect1s) or count($sect2s|$nextsect2) = count($sect2s))">
+ <axsl:apply-templates select="$nextsect2" mode="toplevel-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="toplevel-sect3">
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect2)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nexttoplevel-component)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect3" or w:pPr/w:pStyle/@w:val = "sect3-title"">
+ <axsl:variable name="nextsect3" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect3" or w:pPr/w:pStyle/@w:val = "sect3-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextsect3">
+ <axsl:variable name="sect4s" select="$nextsect3/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect4" or w:pPr/w:pStyle/@w:val = "sect4-title"]"/>
+ <wx:sub-section class="sect3">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect3 and (not($sect2s) or count($sect3s|$nextsect3) = count($sect3s))">
+ <axsl:apply-templates select="$nextsect3" mode="toplevel-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect4s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect4" or w:pPr/w:pStyle/@w:val = "sect4-title"]"/>
+ <wx:sub-section class="sect3">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect3 and (not($sect2s) or count($sect3s|$nextsect3) = count($sect3s))">
+ <axsl:apply-templates select="$nextsect3" mode="toplevel-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="toplevel-sect4">
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect3)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect2)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nexttoplevel-component)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect4" or w:pPr/w:pStyle/@w:val = "sect4-title"">
+ <axsl:variable name="nextsect4" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect4" or w:pPr/w:pStyle/@w:val = "sect4-title"][1]"/>
+ <axsl:choose>
+ <axsl:when test="$nextsect4">
+ <axsl:variable name="sect5s" select="$nextsect4/preceding-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect5" or w:pPr/w:pStyle/@w:val = "sect5-title"]"/>
+ <wx:sub-section class="sect4">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect4 and (not($sect3s) or count($sect4s|$nextsect4) = count($sect4s))">
+ <axsl:apply-templates select="$nextsect4" mode="toplevel-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:variable name="sect5s" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect5" or w:pPr/w:pStyle/@w:val = "sect5-title"]"/>
+ <wx:sub-section class="sect4">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect4 and (not($sect3s) or count($sect4s|$nextsect4) = count($sect4s))">
+ <axsl:apply-templates select="$nextsect4" mode="toplevel-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="toplevel-sect5">
+ <axsl:param name="nextsect4" select="/.."/>
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect5s"/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect4)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect3)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect2)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nexttoplevel-component)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "sect5" or w:pPr/w:pStyle/@w:val = "sect5-title"">
+ <axsl:variable name="nextsect5" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "sect5" or w:pPr/w:pStyle/@w:val = "sect5-title"][1]"/>
+ <wx:sub-section class="sect5">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-terminal">
+ <axsl:with-param name="nextsect5" select="$nextsect5"/>
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="$nextsect5 and (not($sect4s) or count($sect5s|$nextsect5) = count($sect5s))">
+ <axsl:apply-templates select="$nextsect5" mode="toplevel-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="glossary-glossdiv">
+ <axsl:param name="nextglossary" select="/.."/>
+ <axsl:param select="/.." name="glossdivs"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextglossary)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "glossdiv" or w:pPr/w:pStyle/@w:val = "glossdiv-title"">
+ <axsl:variable name="nextglossdiv" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "glossdiv" or w:pPr/w:pStyle/@w:val = "glossdiv-title"][1]"/>
+ <wx:sub-section class="glossdiv">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="glossary-terminal">
+ <axsl:with-param name="nextglossdiv" select="$nextglossdiv"/>
+ <axsl:with-param name="nextglossary" select="$nextglossary"/>
+ <axsl:with-param name="glossdivs" select="$glossdivs"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="count($glossdivs|$nextglossdiv) = count($glossdivs)">
+ <axsl:apply-templates select="$nextglossdiv" mode="glossary-glossdiv">
+ <axsl:with-param name="nextglossary" select="$nextglossary"/>
+ <axsl:with-param name="glossdivs" select="$glossdivs"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="glossary-glossdiv">
+ <axsl:with-param name="nextglossary" select="$nextglossary"/>
+ <axsl:with-param name="glossdivs" select="$glossdivs"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="bibliography-bibliodiv">
+ <axsl:param name="nextbibliography" select="/.."/>
+ <axsl:param select="/.." name="bibliodivs"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextbibliography)"/>
+ <axsl:when test="w:pPr/w:pStyle/@w:val = "bibliodiv" or w:pPr/w:pStyle/@w:val = "bibliodiv-title"">
+ <axsl:variable name="nextbibliodiv" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "bibliodiv" or w:pPr/w:pStyle/@w:val = "bibliodiv-title"][1]"/>
+ <wx:sub-section class="bibliodiv">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="bibliography-terminal">
+ <axsl:with-param name="nextbibliodiv" select="$nextbibliodiv"/>
+ <axsl:with-param name="nextbibliography" select="$nextbibliography"/>
+ <axsl:with-param name="bibliodivs" select="$bibliodivs"/>
+ </axsl:apply-templates>
+ </wx:sub-section>
+ <axsl:if test="count($bibliodivs|$nextbibliodiv) = count($bibliodivs)">
+ <axsl:apply-templates select="$nextbibliodiv" mode="bibliography-bibliodiv">
+ <axsl:with-param name="nextbibliography" select="$nextbibliography"/>
+ <axsl:with-param name="bibliodivs" select="$bibliodivs"/>
+ </axsl:apply-templates>
+ </axsl:if>
+ </axsl:when>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="bibliography-bibliodiv">
+ <axsl:with-param name="nextbibliography" select="$nextbibliography"/>
+ <axsl:with-param name="bibliodivs" select="$bibliodivs"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="book-terminal">
+ <axsl:param name="nextsect5" select="/.."/>
+ <axsl:param name="nextsect4" select="/.."/>
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect5s"/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect5)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect4)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect3)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect2)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook-component)"/>
+ <axsl:when test="generate-id() = generate-id($nextbook)"/>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-terminal">
+ <axsl:with-param name="nextsect5" select="$nextsect5"/>
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="toplevel-terminal">
+ <axsl:param name="nextsect5" select="/.."/>
+ <axsl:param name="nextsect4" select="/.."/>
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect5s"/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextsect5)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect4)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect3)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect2)"/>
+ <axsl:when test="generate-id() = generate-id($nextsect1)"/>
+ <axsl:when test="generate-id() = generate-id($nexttoplevel-component)"/>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-terminal">
+ <axsl:with-param name="nextsect5" select="$nextsect5"/>
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="glossary-terminal">
+ <axsl:param name="nextglossdiv" select="/.."/>
+ <axsl:param name="nextglossary" select="/.."/>
+ <axsl:param select="/.." name="glossdivs"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextglossdiv)"/>
+ <axsl:when test="generate-id() = generate-id($nextglossary)"/>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="glossary-terminal">
+ <axsl:with-param name="nextglossdiv" select="$nextglossdiv"/>
+ <axsl:with-param name="nextglossary" select="$nextglossary"/>
+ <axsl:with-param name="glossdivs" select="$glossdivs"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="w:p" mode="bibliography-terminal">
+ <axsl:param name="nextbibliodiv" select="/.."/>
+ <axsl:param name="nextbibliography" select="/.."/>
+ <axsl:param select="/.." name="bibliodivs"/>
+ <axsl:choose>
+ <axsl:when test="generate-id() = generate-id($nextbibliodiv)"/>
+ <axsl:when test="generate-id() = generate-id($nextbibliography)"/>
+ <axsl:otherwise>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="bibliography-terminal">
+ <axsl:with-param name="nextbibliodiv" select="$nextbibliodiv"/>
+ <axsl:with-param name="nextbibliography" select="$nextbibliography"/>
+ <axsl:with-param name="bibliodivs" select="$bibliodivs"/>
+ </axsl:apply-templates>
+ </axsl:otherwise>
+ </axsl:choose>
+ </axsl:template>
+ <axsl:template match="*">
+ <axsl:call-template name="copy"/>
+ </axsl:template>
+ <axsl:template match="*" mode="book">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book"/>
+ </axsl:template>
+ <axsl:template match="*" mode="book-component">
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-component">
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="book-sect1">
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect1">
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="book-sect2">
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="book-sect3">
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="book-sect4">
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="book-sect5">
+ <axsl:param name="nextsect4" select="/.."/>
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nextbook-component" select="/.."/>
+ <axsl:param name="nextbook" select="/.."/>
+ <axsl:param select="/.." name="sect5s"/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:param select="/.." name="book-components"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="book-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nextbook-component" select="$nextbook-component"/>
+ <axsl:with-param name="nextbook" select="$nextbook"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ <axsl:with-param name="book-components" select="$book-components"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="toplevel-component">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-component"/>
+ </axsl:template>
+ <axsl:template match="*" mode="toplevel-sect1">
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect1">
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="toplevel-sect2">
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect2">
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="toplevel-sect3">
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect3">
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="toplevel-sect4">
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect4">
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="toplevel-sect5">
+ <axsl:param name="nextsect4" select="/.."/>
+ <axsl:param name="nextsect3" select="/.."/>
+ <axsl:param name="nextsect2" select="/.."/>
+ <axsl:param name="nextsect1" select="/.."/>
+ <axsl:param name="nexttoplevel-component" select="/.."/>
+ <axsl:param select="/.." name="sect5s"/>
+ <axsl:param select="/.." name="sect4s"/>
+ <axsl:param select="/.." name="sect3s"/>
+ <axsl:param select="/.." name="sect2s"/>
+ <axsl:param select="/.." name="sect1s"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="toplevel-sect5">
+ <axsl:with-param name="nextsect4" select="$nextsect4"/>
+ <axsl:with-param name="nextsect3" select="$nextsect3"/>
+ <axsl:with-param name="nextsect2" select="$nextsect2"/>
+ <axsl:with-param name="nextsect1" select="$nextsect1"/>
+ <axsl:with-param name="nexttoplevel-component" select="$nexttoplevel-component"/>
+ <axsl:with-param name="sect5s" select="$sect5s"/>
+ <axsl:with-param name="sect4s" select="$sect4s"/>
+ <axsl:with-param name="sect3s" select="$sect3s"/>
+ <axsl:with-param name="sect2s" select="$sect2s"/>
+ <axsl:with-param name="sect1s" select="$sect1s"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="glossary">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="glossary"/>
+ </axsl:template>
+ <axsl:template match="*" mode="glossary-glossdiv">
+ <axsl:param name="nextglossary" select="/.."/>
+ <axsl:param select="/.." name="glossdivs"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="glossary-glossdiv">
+ <axsl:with-param name="nextglossary" select="$nextglossary"/>
+ <axsl:with-param name="glossdivs" select="$glossdivs"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template match="*" mode="bibliography">
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="bibliography"/>
+ </axsl:template>
+ <axsl:template match="*" mode="bibliography-bibliodiv">
+ <axsl:param name="nextbibliography" select="/.."/>
+ <axsl:param select="/.." name="bibliodivs"/>
+ <axsl:call-template name="copy"/>
+ <axsl:apply-templates select="following-sibling::*[1]" mode="bibliography-bibliodiv">
+ <axsl:with-param name="nextbibliography" select="$nextbibliography"/>
+ <axsl:with-param name="bibliodivs" select="$bibliodivs"/>
+ </axsl:apply-templates>
+ </axsl:template>
+ <axsl:template name="copy">
+ <axsl:copy>
+ <axsl:for-each select="@*">
+ <axsl:copy/>
+ </axsl:for-each>
+ <axsl:apply-templates/>
+ </axsl:copy>
+ </axsl:template>
+</axsl:stylesheet>