+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:sfa="http://developer.apple.com/namespaces/sfa"
- xmlns:sf="http://developer.apple.com/namespaces/sf"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:sl="http://developer.apple.com/namespaces/sl"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:w='urn:not-yet-implemented'
- xmlns:wx='urn:not-yet-implemented'
- xmlns:aml='urn:not-yet-implemented'
- xmlns:doc='http://www.oasis-open.org/docbook/xml/4.0'
- exclude-result-prefixes='doc xi w wx aml'>
-
- <xsl:output method="xml" indent='yes' encoding='ascii'/>
-
- <!-- ********************************************************************
- $Id$
- ********************************************************************
-
- This file is part of the XSL DocBook Stylesheet distribution.
- See ../README or http://docbook.sf.net/release/xsl/current/ for
- copyright and other information.
-
- ******************************************************************** -->
-
- <xsl:include href='../VERSION'/>
- <xsl:include href='param.xsl'/>
-
- <xsl:variable name='templatedoc' select='document($pages.template)'/>
-
- <!-- Lookup style identifiers from their user-visible name -->
- <xsl:variable name='paragraph-styles'
- select='$templatedoc//sf:paragraphstyle'/>
- <xsl:variable name='character-styles'
- select='$templatedoc//sf:characterstyle'/>
-
- <xsl:template match="/" name='pages.top'>
- <xsl:param name='doc' select='/'/>
-
- <xsl:if test='not($pages.template)'>
- <xsl:message terminate='yes'>Please specify the template document with the "pages.template" parameter</xsl:message>
- </xsl:if>
- <xsl:if test='not($templatedoc)'>
- <xsl:message terminate='yes'>Unable to open template document "<xsl:value-of select='$pages.template'/>"</xsl:message>
- </xsl:if>
-
- <sl:document
- sfa:ID="SLPublicationModel-0"
- sl:version="2004093000"
- sl:generator="slingshot"
- sl:app_build_date="Mar 4 2005, 11:22:49">
-
- <xsl:apply-templates select='$templatedoc/sl:document/*[not(self::sf:text-storage)]' mode='copy'/>
-
- <xsl:apply-templates select='$doc/*' mode='toplevel'/>
-
- <xsl:apply-templates select='$templatedoc/sl:document/sf:text-storage/following-sibling::*' mode='copy'/>
- </sl:document>
- </xsl:template>
-
- <xsl:template match='book|article|chapter|preface|appendix' mode='toplevel'>
- <sf:text-storage sf:kind='body' sfa:ID='SFWPStorage-7'>
- <sf:stylesheet-ref sfa:IDREF='SFSStylesheet-1'/>
- <sf:text-body>
- <sf:page-start sf:page-index='0'/>
- <sf:container-hint sf:page-index="0" sf:cindex="0" sf:sindex="0" sf:lindex="0" sf:frame-x="56.692913055419922" sf:frame-y="56.692913055419922" sf:frame-w="481.61416625976562" sf:frame-h="714" sf:anchor-loc="0"/>
-
- <sf:section sf:name="Chapter 1" sf:style="section-style-0">
- <sf:layout sf:style="layout-style-20">
- <xsl:apply-templates select='*'/>
- </sf:layout>
- </sf:section>
- </sf:text-body>
- </sf:text-storage>
- </xsl:template>
-
- <xsl:template match='book|article|part|section|sect1|sect2|sect3|sect4|sect5|simplesect|bibliodiv'>
- <xsl:apply-templates select='*'/>
- </xsl:template>
-
- <xsl:template match='articleinfo|bookinfo|chapterinfo|prefaceinfo|appendixinfo'>
- <xsl:apply-templates select='title|subtitle|titleabbrev'/>
- <xsl:apply-templates select='author|releaseinfo|revhistory|abstract'/>
- <!-- current implementation ignores all other metadata -->
- <xsl:for-each select='*[not(self::title|self::subtitle|self::titleabbrev|self::author|self::releaseinfo|self::revhistory|self::abstract)]'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- </xsl:template>
-
- <!-- It is easier for authors to have metadata for a component
- appearing after the corresponding title, rather than before it.
- The reverse transformation will put things back the right way.
- -->
-
- <xsl:template match='sectioninfo|sect1info|sect2info|sect3info|sect4info|sect5info |
- appendix|bibliography|chapter'>
- <xsl:apply-templates select='title|subtitle|titleabbrev'/>
- <xsl:apply-templates select='*[local-name() = concat(local-name(current()), "info")]'/>
- <xsl:apply-templates select='*[not(self::title|self::subtitle|self::titleabbrev) and
- local-name() != concat(local-name(current()), "info")]'/>
- </xsl:template>
-
- <xsl:template match='title|subtitle|titleabbrev'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:choose>
- <xsl:when test='(parent::section or
- parent::sectioninfo/parent::section) and
- count(ancestor::section) > 5'>
- <xsl:message>section nested deeper than 5 levels</xsl:message>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:text>sect5-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test='parent::sectioninfo'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:text>sect</xsl:text>
- <xsl:value-of select='count(ancestor::section)'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test='parent::sect1info |
- parent::sect2info |
- parent::sect3info |
- parent::sect4info |
- parent::sect5info |
- parent::appendixinfo |
- parent::bibliographyinfo |
- parent::chapterinfo'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='substring-before(name(..), "info")'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test='parent::section'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:text>sect</xsl:text>
- <xsl:value-of select='count(ancestor::section)'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test='parent::sect1 |
- parent::sect2 |
- parent::sect3 |
- parent::sect4 |
- parent::sect5 |
- parent::appendix |
- parent::bibliography |
- parent::bibliodiv |
- parent::biblioentry |
- parent::chapter |
- parent::qandaset |
- parent::qandadiv'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name(..)'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test='parent::book|../parent::book |
- parent::article|../parent::article |
- parent::part|../parent::part|
- parent::formalpara'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name(ancestor::*[self::book|self::article|self::part|self::formalpara][1])'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test='parent::objectinfo|parent::blockinfo'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name(../..)'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>Title</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
-
- <doc:template name='metadata' xmlns=''>
- <title>Metadata</title>
-
- <para>TODO: Handle all metadata elements, apart from titles.</para>
- </doc:template>
- <xsl:template match='*[contains(name(), "info")]/*[not(self::title|self::subtitle|self::titleabbrev)]' priority='0'/>
-
- <xsl:template match='author|editor|othercredit'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates select='personname|surname|firstname|honorific|lineage|othername|contrib'/>
- <sf:br/>
- </sf:p>
- <xsl:apply-templates select='affiliation|address'/>
- <xsl:apply-templates select='authorblurb|personblurb'/>
- </xsl:template>
- <xsl:template match='affiliation'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>affiliation</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
- <xsl:template match='address[parent::author|parent::editor|parent::othercredit|parent::publisher]'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>para-continue</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
- <!-- do not attempt to handle recursive structures -->
- <xsl:template match='address[not(parent::author|parent::editor|parent::othercredit|parent::publisher)]'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>address</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:apply-templates select='node()[not(self::affiliation|self::authorblurb)]'/>
- <sf:br/>
- </sf:p>
- </xsl:template>
- <!-- TODO -->
- <xsl:template match='authorblurb|personblurb'/>
-
- <xsl:template match='surname|firstname|honorific|lineage|othername|contrib|email|shortaffil|jobtitle|orgname|orgdiv|street|pob|postcode|city|state|country|phone|fax|citetitle'>
- <xsl:if test='preceding-sibling::*'>
- <xsl:text> </xsl:text>
- </xsl:if>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates mode='text-run'/>
- </sf:span>
- </xsl:template>
- <xsl:template match='email'>
- <xsl:variable name='address'>
- <xsl:choose>
- <xsl:when test='starts-with(., "mailto:")'>
- <xsl:value-of select='.'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>mailto:</xsl:text>
- <xsl:value-of select='.'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <sf:link href='{$address}'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>email</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:apply-templates mode='text-run'/>
- </sf:span>
- </sf:link>
- </xsl:template>
- <!-- otheraddr often contains ulink -->
- <xsl:template match='otheraddr'>
- <xsl:choose>
- <xsl:when test='ulink'>
- <xsl:for-each select='ulink'>
- <xsl:variable name='prev' select='preceding-sibling::ulink[1]'/>
- <xsl:choose>
- <xsl:when test='$prev'>
- <xsl:for-each
- select='preceding-sibling::node()[generate-id(following-sibling::ulink[1]) = generate-id(current())]'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>otheraddr</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:apply-templates select='.' mode='text-run'/>
- </sf:span>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test='preceding-sibling::node()'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>otheraddr</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:apply-templates mode='text-run'/>
- </sf:span>
- </xsl:when>
- </xsl:choose>
- <xsl:apply-templates select='.'/>
- </xsl:for-each>
- <xsl:if test='ulink[last()]/following-sibling::node()'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>otheraddr</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:apply-templates select='ulink[last()]/following-sibling::node()' mode='text-run'/>
- </sf:span>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>otheraddr</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:apply-templates mode='text-run'/>
- </sf:span>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='ulink'>
- <sf:link href='{@url}'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>ulink</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- </sf:span>
- <xsl:apply-templates mode='text-run'/>
- </sf:link>
- </xsl:template>
-
- <xsl:template match='inlinegraphic'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name' select='name()'/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:value-of select='@fileref'/>
- </sf:span>
- </xsl:template>
-
- <!-- Cannot round-trip this element -->
- <xsl:template match='personname'>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match='releaseinfo|bibliomisc|bibliorelation|publishername|isbn'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name' select='name()'/>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
-
- <xsl:template match='revhistory|biblioentry'>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match='revision'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>revision</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <!-- not currently supporting author -->
- <xsl:apply-templates select='revnumber|date|authorinitials'/>
- <sf:br/>
- </sf:p>
- <!-- not currently supporting revdescription -->
- <xsl:apply-templates select='revremark'/>
- </xsl:template>
- <xsl:template match='revnumber|date|authorinitials'>
- <xsl:if test='preceding-sibling::*'>
- <xsl:text> </xsl:text>
- </xsl:if>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates/>
- </sf:span>
- </xsl:template>
- <xsl:template match='revremark'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>revremark</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
-
- <xsl:template match='abstract'>
- <xsl:apply-templates>
- <xsl:with-param name='class'>abstract</xsl:with-param>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match='para'>
- <xsl:param name='class'/>
-
- <xsl:variable name='block' select='blockquote|calloutlist|classsynopsis|funcsynopsis|figure|glosslist|graphic|informalfigure|informaltable|itemizedlist|literallayout|mediaobject|mediaobjectco|note|caution|warning|important|tip|orderedlist|programlisting|programlistingco|revhistory|segmentedlist|simplelist|table|variablelist'/>
-
- <xsl:choose>
- <xsl:when test='$block'>
- <sf:p>
- <xsl:call-template name='para-style'>
- <xsl:with-param name='class' select='$class'/>
- </xsl:call-template>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates select='$block[1]/preceding-sibling::node()'/>
- <sf:br/>
- </sf:p>
- <xsl:for-each select='$block'>
- <xsl:apply-templates select='.'/>
- <sf:p>
- <xsl:call-template name='para-style'>
- <xsl:with-param name='class' select='$class'/>
- </xsl:call-template>
- <xsl:apply-templates select='following-sibling::node()[generate-id(preceding-sibling::*[self::blockquote|self::calloutlist|self::figure|self::glosslist|self::graphic|self::informalfigure|self::informaltable|self::itemizedlist|self::literallayout|self::mediaobject|self::mediaobjectco|self::note|self::caution|self::warning|self::important|self::tip|self::orderedlist|self::programlisting|self::programlistingco|self::revhistory|self::segmentedlist|self::simplelist|self::table|self::variablelist][1]) = generate-id(current())]'/>
- <sf:br/>
- </sf:p>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <sf:p>
- <xsl:call-template name='para-style'>
- <xsl:with-param name='class' select='$class'/>
- </xsl:call-template>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='simpara'>
- <xsl:param name='class'/>
-
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>simpara</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
- <xsl:template name='para-style'>
- <xsl:param name='class'/>
-
- <xsl:variable name='style' select='$paragraph-styles[@sf:name = $class]'/>
-
- <xsl:attribute name='sf:style'>
- <xsl:choose>
- <xsl:when test='$style'>
- <xsl:value-of select='$style/@sf:ident'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>para</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:template>
-
- <xsl:template match='emphasis'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:choose>
- <xsl:when test='@role = "underline"'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>emphasis-underline</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test='@role = "bold" or @role = "strong"'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>emphasis-bold</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test='not(@role) or @role="italic"'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>emphasis</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:attribute>
-
- <xsl:apply-templates/>
- </sf:span>
- </xsl:template>
-
- <xsl:template match='filename|sgmltag|application|literal'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates/>
- </sf:span>
- </xsl:template>
-
- <xsl:template match='example|figure'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- <xsl:text>-title</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates select='title' mode='textonly'/>
- <sf:br/>
- </sf:p>
- <xsl:apply-templates select='*[not(self::title)][1]'/>
- <xsl:apply-templates select='*[not(self::title)][position() != 1]'
- mode='error'/>
- </xsl:template>
-
- <xsl:template match='informalfigure'>
- <xsl:if test='mediaobject/imageobject/imagedata'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>informalfigure-imagedata</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates select='mediaobject/imageobject/imagedata/@fileref'
- mode='textonly'/>
- <sf:br/>
- </sf:p>
- </xsl:if>
- <xsl:for-each select='*[not(self::mediaobject)]'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match='mediaobject|mediaobjectco'>
- <xsl:apply-templates select='objectinfo/title'/>
- <xsl:apply-templates select='objectinfo/subtitle'/>
- <!-- TODO: indicate error for other children of objectinfo -->
-
- <xsl:apply-templates select='*[not(self::objectinfo)]'/>
- </xsl:template>
- <xsl:template match='imageobject|imageobjectco|audioobject|videoobject'>
-
- <xsl:apply-templates select='objectinfo/title'/>
- <xsl:apply-templates select='objectinfo/subtitle'/>
- <!-- TODO: indicate error for other children of objectinfo -->
-
- <xsl:apply-templates select='areaspec'/>
-
- <xsl:choose>
- <xsl:when test='imagedata|audiodata|videodata'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name(imagedata|audiodata|videodata)'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates select='*/@fileref'
- mode='textonly'/>
- <sf:br/>
- </sf:p>
- </xsl:when>
- <xsl:when test='self::imageobjectco/imageobject/imagedata'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- <xsl:text>-imagedata</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates select='imageobject/imagedata/@fileref'
- mode='textonly'/>
- <sf:br/>
- </sf:p>
- </xsl:when>
- </xsl:choose>
- <xsl:apply-templates select='calloutlist'/>
-
- <xsl:for-each select='*[not(self::imageobject |
- self::imagedata |
- self::audiodata |
- self::videodata |
- self::areaspec |
- self::calloutlist)]'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match='textobject'>
- <xsl:choose>
- <xsl:when test='objectinfo/title|objectinfo|subtitle'>
- <xsl:apply-templates select='objectinfo/title'/>
- <xsl:apply-templates select='objectinfo/subtitle'/>
- <!-- TODO: indicate error for other children of objectinfo -->
- </xsl:when>
- <xsl:otherwise>
- <!-- synthesize a title so that the parent textobject
- can be recreated.
- -->
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>textobject-title</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:text>Text Object </xsl:text>
- <xsl:number level='any'/>
- <sf:br/>
- </sf:p>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:apply-templates select='*[not(self::objectinfo)]'/>
- </xsl:template>
-
- <xsl:template match='caption'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>caption</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:choose>
- <xsl:when test='not(*)'>
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select='para[1]/node()'/>
- <xsl:for-each select='text()|*[not(self::para)]|para[position() != 1]'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- <sf:br/>
- </sf:p>
- </xsl:template>
-
- <xsl:template match='qandaset|qandadiv'>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match='qandaentry'>
- <xsl:for-each select='revhistory'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- <xsl:apply-templates select='*[not(self::revhistory)]'/>
- </xsl:template>
- <xsl:template match='question|answer'>
- <xsl:choose>
- <xsl:when test='*[1][self::para]'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates select='*[1]/node()'/>
- <sf:br/>
- </sf:p>
-
- <xsl:apply-templates select='*[position() != 1]' mode='question'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>first element in a question must be a paragraph</xsl:message>
- <xsl:apply-templates mode='error'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='para' mode='question'>
- <xsl:apply-templates select='.'>
- <xsl:with-param name='class' select='"para-continue"'/>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match='*' mode='question'>
- <xsl:apply-templates select='.'/>
- </xsl:template>
-
- <xsl:template match='table|informaltable' mode='not-yet-implemented'>
-
- <w:tbl>
- <w:tblPr>
- <w:tblW w:w="0" w:type="auto"/>
- <w:tblInd w:w="108" w:type="dxa"/>
- <w:tblLayout w:type="Fixed"/>
- </w:tblPr>
- <w:tblGrid>
- <xsl:apply-templates select='tgroup/colspec' mode='column'/>
- </w:tblGrid>
- <xsl:apply-templates/>
- </w:tbl>
- </xsl:template>
-
- <xsl:template match='colspec' mode='column'>
- <w:gridcol w:w='{@colwidth}'/>
- </xsl:template>
-
- <xsl:template match='colspec'/>
-
- <xsl:template name='repeat'>
- <xsl:param name='repeats' select='0'/>
- <xsl:param name='content'/>
-
- <xsl:if test='$repeats > 0'>
- <xsl:copy-of select='$content'/>
- <xsl:call-template name='repeat'>
- <xsl:with-param name='repeats' select='$repeats - 1'/>
- <xsl:with-param name='content' select='$content'/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
- <xsl:template match='tgroup|tbody|thead'>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match='row'>
- <w:tr>
- <w:trPr>
- <xsl:if test='parent::thead'>
- <w:tblHeader/>
- </xsl:if>
- </w:trPr>
- <xsl:apply-templates/>
- </w:tr>
- </xsl:template>
-
- <xsl:template match='entry'>
-
- <!--
- Position = Sum(i,preceding-sibling[@colspan = ""]) + entry[i].@colspan)
- -->
-
- <xsl:variable name='position'>
- <xsl:call-template name='sumSibling'>
- <xsl:with-param name='sum' select='"1"'/>
- <xsl:with-param name='node' select='.'/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:variable name='limit' select='$position + @colspan'/>
- <w:tc>
- <w:tcPr>
- <xsl:choose>
- <xsl:when test='@colspan != ""'>
-
- <!-- Select all the colspec nodes which correspond to the
- column. That is all the nodes between the current
- column number and the column number plus the span.
- -->
-
- <xsl:variable name='combinedWidth'>
- <xsl:call-template name='sum'>
- <xsl:with-param name='nodes' select='ancestor::*[self::table|self::informaltable][1]/tgroup/colspec[not(position() < $position) and position() < $limit]'/>
- <xsl:with-param name='sum' select='"0"'/>
- </xsl:call-template>
- </xsl:variable>
- <w:tcW w:w='{$combinedWidth}' w:type='dxa'/>
- </xsl:when>
- <xsl:otherwise>
- <w:tcW w:w='{ancestor::*[self::table|self::informaltable][1]/tgroup/colspec[position() = $position]/@colwidth}' w:type='dxa'/>
- </xsl:otherwise>
- </xsl:choose>
-
- </w:tcPr>
- <xsl:if test='@hidden != ""'>
- <w:vmerge w:val=''/>
- </xsl:if>
- <xsl:if test='@rowspan != ""'>
- <w:vmerge w:val='restart'/>
- </xsl:if>
- <xsl:if test='@colspan != ""'>
- <w:gridspan w:val='{@colspan}'/>
- </xsl:if>
- <xsl:choose>
- <xsl:when test='not(para)'>
- <!-- TODO: check for any block elements -->
- <w:p>
- <xsl:apply-templates/>
- </w:p>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </w:tc>
- </xsl:template>
-
- <!-- Calculates the position by adding the
- count of the preceding siblings where they aren't colspans
- and adding the colspans of those entries which do.
- -->
-
- <xsl:template name='sumSibling'>
- <xsl:param name='sum'/>
- <xsl:param name='node'/>
-
- <xsl:variable name='add'>
- <xsl:choose>
- <xsl:when test='$node/preceding-sibling::entry/@colspan != ""'>
- <xsl:value-of select='$node/preceding-sibling::entry/@colspan'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='"1"'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test='count($node/preceding-sibling::entry) > 0'>
- <xsl:call-template name='sumSibling'>
- <xsl:with-param name='sum' select='$sum + $add'/>
- <xsl:with-param name='node' select='$node/preceding-sibling::entry[1]'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='$sum'/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
- <xsl:template name='sum'>
- <xsl:param name='sum' select='"0"'/>
- <xsl:param name='nodes'/>
-
- <xsl:variable name='tmpSum' select='$sum + $nodes[1]/@colwidth'/>
-
- <xsl:choose>
- <xsl:when test='count($nodes) > 1'>
- <xsl:call-template name='sum'>
- <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
- <xsl:with-param name='sum' select='$tmpSum'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='$tmpSum'/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
- <xsl:template match='text()[string-length(normalize-space(.)) = 0]'/>
- <xsl:template match='text()' mode='text-run'>
- <xsl:value-of select='.'/>
- </xsl:template>
- <xsl:template match='literallayout/text()|programlisting/text()'>
- <xsl:call-template name='handle-linebreaks'/>
- </xsl:template>
- <xsl:template name='handle-linebreaks'>
- <xsl:param name='text' select='.'/>
-
- <xsl:choose>
- <xsl:when test='not($text)'/>
- <xsl:when test='contains($text, "
")'>
- <xsl:value-of select='substring-before($text, "
")'/>
- <xsl:call-template name='handle-linebreaks-aux'>
- <xsl:with-param name='text'
- select='substring-after($text, "
")'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='$text'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- pre-condition: leading linefeed has been stripped -->
- <xsl:template name='handle-linebreaks-aux'>
- <xsl:param name='text'/>
-
- <xsl:choose>
- <xsl:when test='contains($text, "
")'>
- <sf:lnbr/>
- <xsl:value-of select='substring-before($text, "
")'/>
- <xsl:call-template name='handle-linebreaks-aux'>
- <xsl:with-param name='text' select='substring-after($text, "
")'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <sf:lnbr/>
- <xsl:value-of select='$text'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match='authorblurb|formalpara|highlights|legalnotice|note|caution|warning|important|tip'>
- <xsl:apply-templates select='*'>
- <xsl:with-param name='class'>
- <xsl:if test='parent::highlights'>
- <xsl:value-of select='name(..)'/>
- <xsl:text>-</xsl:text>
- </xsl:if>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match='blockquote'>
- <xsl:apply-templates select='blockinfo|title'>
- <xsl:with-param name='class'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:apply-templates>
- <xsl:apply-templates select='*[not(self::blockinfo|self::title|self::attribution)]'>
- <xsl:with-param name='class' select='"blockquote"'/>
- </xsl:apply-templates>
- <xsl:if test='attribution'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='blockquote-attribution'/>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates select='attribution/node()'/>
- </w:p>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match='programlistingco'>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match='literallayout|programlisting'>
- <xsl:param name='class'/>
-
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:if test='$class != ""'>
- <xsl:value-of select='$class'/>
- <xsl:text>-</xsl:text>
- </xsl:if>
- <xsl:choose>
- <xsl:when test='self::programlisting/parent::programlistingco'>
- <xsl:value-of select='name(..)'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='name()'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
-
- <xsl:template match='areaspec'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name' select='name()'/>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <sf:br/>
- </sf:p>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match='area'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name' select='name()'/>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
-
- <xsl:template match='calloutlist'>
- <xsl:apply-templates select='callout'/>
- </xsl:template>
-
- <xsl:template match='callout'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <!-- Normally a para would be the first child of a callout -->
- <xsl:apply-templates select='*[1][self::para]/node()' mode='list'/>
- <sf:br/>
- </sf:p>
- <!-- This is to catch the case where a listitem's first child is not a paragraph.
- - We may not be able to represent this properly.
- -->
- <xsl:apply-templates select='*[1][not(self::para)]' mode='list'/>
-
- <xsl:apply-templates select='*[position() != 1]' mode='list'/>
- </xsl:template>
-
- <xsl:template match='itemizedlist|orderedlist'>
- <xsl:apply-templates select='listitem'/>
- </xsl:template>
-
- <xsl:template match='listitem'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:choose>
- <xsl:when test='../parent::highlights'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:text>highlights-</xsl:text>
- <xsl:value-of select='name(..)'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>
- <xsl:value-of select='name(..)'/>
- <xsl:value-of select='count(ancestor::itemizedlist|ancestor::orderedlist|ancestor::calloutlist)'/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <!-- Normally a para would be the first child of a listitem -->
- <xsl:apply-templates select='*[1][self::para]/node()' mode='list'/>
- <sf:br/>
- </sf:p>
- <!-- This is to catch the case where a listitem's first child is not a paragraph.
- - We may not be able to represent this properly.
- -->
- <xsl:apply-templates select='*[1][not(self::para)]' mode='list'/>
-
- <xsl:apply-templates select='*[position() != 1]' mode='list'/>
- </xsl:template>
-
- <xsl:template match='*' mode='list'>
- <xsl:apply-templates select='.'>
- <xsl:with-param name='class' select='"para-continue"'/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match='variablelist'>
- <xsl:apply-templates select='*[not(self::varlistentry)]'/>
-
- <w:tbl>
- <w:tblPr>
- <w:tblW w:w='0' w:type='auto'/>
- <w:tblInd w:w='108' w:type='dxa'/>
- <w:tblLayout w:type='Fixed'/>
- </w:tblPr>
- <w:tblGrid>
- <w:gridcol w:w='2160'/>
- <w:gridcol w:w='6480'/>
- </w:tblGrid>
- <xsl:apply-templates select='varlistentry'/>
- </w:tbl>
- </xsl:template>
- <xsl:template match='varlistentry'>
- <w:tr>
- <w:trPr>
- </w:trPr>
-
- <w:tc>
- <w:tcPr>
- <w:tcW w:w='2160' w:type='dxa'/>
- </w:tcPr>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='variablelist-term'/>
- </w:pPr>
- <xsl:apply-templates select='term[1]/node()'/>
- <xsl:for-each select='term[position() != 1]'>
- <w:r>
- <w:br/>
- </w:r>
- <xsl:apply-templates/>
- </xsl:for-each>
- </w:p>
- </w:tc>
- <w:tc>
- <w:tcPr>
- <w:tcW w:w='6480' w:type='dxa'/>
- </w:tcPr>
- <xsl:apply-templates select='listitem/node()'/>
- </w:tc>
- </w:tr>
- </xsl:template>
-
- <xsl:template match='bridgehead'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name' select='name()'/>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- <sf:br/>
- </sf:p>
- </xsl:template>
-
- <xsl:template match='xi:include'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>xinclude</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:value-of select='@href'/>
- <sf:br/>
- </sf:p>
- </xsl:template>
-
- <!-- These elements are not displayed.
- - However, they may need to be added (perhaps as hidden text)
- - for round-tripping.
- -->
- <xsl:template match='anchor|areaset|audiodata|audioobject|
- beginpage|
- constraint|
- indexterm|itermset|
- keywordset|
- msg'/>
-
- <xsl:template match='*' mode='error'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>blockerror</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:value-of select='name()'/>
- <xsl:text> encountered</xsl:text>
- <xsl:if test='parent::*'>
- <xsl:text> in </xsl:text>
- <xsl:value-of select='name(parent::*)'/>
- </xsl:if>
- <xsl:text> cannot be supported.</xsl:text>
- <sf:br/>
- </sf:p>
- </xsl:template>
- <xsl:template match='*' name='nomatch'>
- <xsl:message>
- <xsl:value-of select='name()'/>
- <xsl:text> encountered</xsl:text>
- <xsl:if test='parent::*'>
- <xsl:text> in </xsl:text>
- <xsl:value-of select='name(parent::*)'/>
- </xsl:if>
- <xsl:text>, but no template matches.</xsl:text>
- </xsl:message>
-
- <xsl:choose>
- <xsl:when test='self::abstract |
- self::ackno |
- self::address |
- self::answer |
- self::appendix |
- self::artheader |
- self::authorgroup |
- self::bibliodiv |
- self::biblioentry |
- self::bibliography |
- self::bibliomixed |
- self::bibliomset |
- self::biblioset |
- self::bridgehead |
- self::calloutlist |
- self::caption |
- self::chapter |
- self::classsynopsis |
- self::colophon |
- self::constraintdef |
- self::copyright |
- self::dedication |
- self::epigraph |
- self::equation |
- self::funcsynopsis |
- self::glossary |
- self::glossdef |
- self::glossdiv |
- self::glossentry |
- self::glosslist |
- self::graphic |
- self::imageobject |
- self::imageobjectco |
- self::index |
- self::indexdiv |
- self::indexentry |
- self::informalequation |
- self::informalexample |
- self::informalfigure |
- self::lot |
- self::lotentry |
- self::mediaobjectco |
- self::member |
- self::msgentry |
- self::msgset |
- self::part |
- self::partintro |
- self::personblurb |
- self::preface |
- self::printhistory |
- self::procedure |
- self::programlistingco |
- self::publisher |
- self::qandadiv |
- self::qandaentry |
- self::qandaset |
- self::question |
- self::refdescriptor |
- self::refentry |
- self::refentrytitle |
- self::reference |
- self::refmeta |
- self::refname |
- self::refnamediv |
- self::refpurpose |
- self::refsect1 |
- self::refsect2 |
- self::refsect3 |
- self::refsection |
- self::refsynopsisdiv |
- self::screen |
- self::screenco |
- self::screenshot |
- self::seg |
- self::seglistitem |
- self::segmentedlist |
- self::segtitle |
- self::set |
- self::setindex |
- self::sidebar |
- self::simplelist |
- self::simplemsgentry |
- self::step |
- self::stepalternatives |
- self::subjectset |
- self::substeps |
- self::task |
- self::textobject |
- self::toc |
- self::videodata |
- self::videoobject |
- self::*[not(starts-with(name(), "informal")) and contains(name(), "info")]'>
- <sf:p>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-paragraph-style'>
- <xsl:with-param name='name'>blockerror</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:value-of select='name()'/>
- <xsl:text> encountered</xsl:text>
- <xsl:if test='parent::*'>
- <xsl:text> in </xsl:text>
- <xsl:value-of select='name(parent::*)'/>
- </xsl:if>
- <xsl:text>, but no template matches.</xsl:text>
- <sf:br/>
- </sf:p>
- </xsl:when>
- <!-- Some elements are sometimes blocks, sometimes inline
- <xsl:when test='self::affiliation |
- self::alt |
- self::attribution |
- self::collab |
- self::collabname |
- self::confdates |
- self::confgroup |
- self::confnum |
- self::confsponsor |
- self::conftitle |
- self::contractnum |
- self::contractsponsor |
- self::contrib |
- self::corpauthor |
- self::corpcredit |
- self::corpname |
- self::edition |
- self::editor |
- self::jobtitle |
- self::personname |
- self::publishername |
- self::remark'>
-
- </xsl:when>
- -->
- <xsl:otherwise>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>inlineerror</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:value-of select='name()'/>
- <xsl:text> encountered</xsl:text>
- <xsl:if test='parent::*'>
- <xsl:text> in </xsl:text>
- <xsl:value-of select='name(parent::*)'/>
- </xsl:if>
- <xsl:text>, but no template matches.</xsl:text>
- </sf:span>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name='attributes'>
- <xsl:param name='node' select='.'/>
-
- <xsl:for-each select='$node/@*'>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>attribute-name</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:value-of select='name()'/>
- </sf:span>
- <sf:span>
- <xsl:attribute name='sf:style'>
- <xsl:call-template name='lookup-character-style'>
- <xsl:with-param name='name'>attribute-value</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:value-of select='.'/>
- </sf:span>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name='lookup-paragraph-style'>
- <xsl:param name='name'/>
-
- <xsl:if test='not($paragraph-styles[@sf:name = $name])'>
- <xsl:message>unable to find character style "<xsl:value-of select='$name'/>"</xsl:message>
- </xsl:if>
-
- <xsl:value-of select='$paragraph-styles[@sf:name = $name]/@sf:ident'/>
- </xsl:template>
- <xsl:template name='lookup-character-style'>
- <xsl:param name='name'/>
-
- <xsl:if test='not($character-styles[@sf:name = $name])'>
- <xsl:message>unable to find character style "<xsl:value-of select='$name'/>"</xsl:message>
- </xsl:if>
-
- <xsl:value-of select='$character-styles[@sf:name = $name]/@sf:ident'/>
- </xsl:template>
-
- <xsl:template match='*' mode='copy'>
- <xsl:copy>
- <xsl:for-each select='@*'>
- <xsl:copy/>
- </xsl:for-each>
- <xsl:apply-templates mode='copy'/>
- </xsl:copy>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="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: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:sl='http://schemas.microsoft.com/schemaLibrary/2003/core'
- xmlns:doc='http://www.oasis-open.org/docbook/xml/4.0'
- exclude-result-prefixes='doc'>
-
- <xsl:output method="xml" indent='yes' standalone='yes' encoding='UTF-8'/>
-
- <!-- ********************************************************************
- $Id$
- ********************************************************************
-
- This file is part of the XSL DocBook Stylesheet distribution.
- See ../README or http://docbook.sf.net/release/xsl/current/ for
- copyright and other information.
-
- ******************************************************************** -->
-
- <xsl:include href='../VERSION'/>
- <xsl:include href='param.xsl'/>
-
- <xsl:variable name='templatedoc' select='document($wordml.template)'/>
-
- <xsl:template match="/" name='wordml.top'>
- <xsl:param name='doc' select='/'/>
-
- <xsl:if test='not($wordml.template)'>
- <xsl:message terminate='yes'>Please specify the template document with the "wordml.template" parameter</xsl:message>
- </xsl:if>
- <xsl:if test='not($templatedoc)'>
- <xsl:message terminate='yes'>Unable to open template document "<xsl:value-of select='$wordml.template'/>"</xsl:message>
- </xsl:if>
-
- <xsl:processing-instruction name='mso-application'>
- <xsl:text>progid="Word.Document"</xsl:text>
- </xsl:processing-instruction>
- <xsl:text>
-</xsl:text>
-
- <xsl:variable name='info'
- select='$doc/book/bookinfo|$doc/article/articleinfo'/>
- <xsl:variable name='authors' select='$info/author|$info/authorinitials|$info/authorgroup/author|$info/authorgroup/editor'/>
-
- <w:wordDocument
- w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no">
- <xsl:attribute name='xml:space'>preserve</xsl:attribute>
-
- <o:DocumentProperties>
- <o:Author>
- <xsl:choose>
- <xsl:when test='$authors'>
- <xsl:apply-templates select='$authors[1]' mode='docprop.author'/>
- </xsl:when>
- <xsl:otherwise>Unknown</xsl:otherwise>
- </xsl:choose>
- </o:Author>
- <o:LastAuthor>
- <xsl:choose>
- <xsl:when test='$info/revhistory/revision[1]/*[self::author|self::authorinitials]'>
- <xsl:apply-templates select='$info/revhistory/revision[1]/*[self::author|self::authorinitials]' mode='docprop.author'/>
- </xsl:when>
- <xsl:when test='$authors'>
- <xsl:apply-templates select='$authors[1]' mode='docprop.author'/>
- </xsl:when>
- <xsl:otherwise>Unknown</xsl:otherwise>
- </xsl:choose>
- </o:LastAuthor>
- <o:Revision>1</o:Revision>
- <o:TotalTime></o:TotalTime>
-
- <!-- dummy values -->
- <o:Created>2004-01-01T07:07:00Z</o:Created>
- <o:LastSaved>2004-01-01T08:08:00Z</o:LastSaved>
-
- <o:Pages>1</o:Pages>
- <o:Words>1</o:Words>
- <o:Characters>1</o:Characters>
-
- <!-- could derive this from author -->
- <o:Company>DocBook</o:Company>
-
- <o:Lines>1</o:Lines>
- <o:Paragraphs>1</o:Paragraphs>
- <o:CharactersWithSpaces>1</o:CharactersWithSpaces>
- <o:Version>11.6113</o:Version>
- </o:DocumentProperties>
-
- <xsl:apply-templates select='$templatedoc/w:wordDocument/o:CustomDocumentProperties|$templatedoc/w:wordDocument/w:fonts|$templatedoc/w:wordDocument/w:lists|$templatedoc/w:wordDocument/w:styles' mode='copy'/>
-
- <w:docPr>
- <w:view w:val="print"/>
- <w:zoom w:percent="100"/>
- <w:doNotEmbedSystemFonts/>
- <w:attachedTemplate w:val=""/>
- <w:defaultTabStop w:val="720"/>
- <w:autoHyphenation/>
- <w:hyphenationZone w:val="357"/>
- <w:doNotHyphenateCaps/>
- <w:evenAndOddHeaders/>
- <w:characterSpacingControl w:val="DontCompress"/>
- <w:optimizeForBrowser/>
- <w:validateAgainstSchema/>
- <w:saveInvalidXML w:val="off"/>
- <w:ignoreMixedContent w:val="off"/>
- <w:alwaysShowPlaceholderText w:val="off"/>
- <w:footnotePr>
- <w:footnote w:type="separator">
- <w:p>
- <w:r>
- <w:separator/>
- </w:r>
- </w:p>
- </w:footnote>
- <w:footnote w:type="continuation-separator">
- <w:p>
- <w:r>
- <w:continuationSeparator/>
- </w:r>
- </w:p>
- </w:footnote>
- </w:footnotePr>
- <w:endnotePr>
- <w:endnote w:type="separator">
- <w:p>
- <w:r>
- <w:separator/>
- </w:r>
- </w:p>
- </w:endnote>
- <w:endnote w:type="continuation-separator">
- <w:p>
- <w:r>
- <w:continuationSeparator/>
- </w:r>
- </w:p>
- </w:endnote>
- </w:endnotePr>
- <w:compat>
- <w:breakWrappedTables/>
- <w:snapToGridInCell/>
- <w:wrapTextWithPunct/>
- <w:useAsianBreakRules/>
- <w:useWord2002TableStyleRules/>
- </w:compat>
- <w:docVars>
- </w:docVars>
- </w:docPr>
-
- <xsl:apply-templates select='$doc/*' mode='toplevel'/>
-
- </w:wordDocument>
- </xsl:template>
-
- <xsl:template match='author|editor' mode='docprop.author'>
- <xsl:apply-templates select='firstname|personname/firstname' mode='docprop.author'/>
- <xsl:text> </xsl:text>
- <xsl:apply-templates select='surname|personname/surname' mode='docprop.author'/>
- </xsl:template>
- <xsl:template match='authorinitials' mode='docprop.author'>
- <xsl:value-of select='.'/>
- </xsl:template>
-
- <xsl:template match='book|article' mode='toplevel'>
- <w:body>
- <wx:sect>
- <wx:sub-section>
- <xsl:apply-templates select='*'/>
- </wx:sub-section>
- </wx:sect>
- </w:body>
- </xsl:template>
- <xsl:template match='*' mode='toplevel'>
- <w:body>
- <wx:sect>
- <wx:sub-section>
- <xsl:apply-templates select='*'/>
- </wx:sub-section>
- </wx:sect>
- </w:body>
- </xsl:template>
-
- <xsl:template match='book|article|chapter|section|sect1|sect2|sect3|sect4|sect5|simplesect'>
- <wx:sub-section>
- <xsl:apply-templates select='*'/>
- </wx:sub-section>
- </xsl:template>
-
- <xsl:template match='articleinfo |
- chapterinfo |
- bookinfo'>
- <xsl:apply-templates select='title|subtitle|titleabbrev'/>
- <xsl:apply-templates select='author|releaseinfo'/>
- <!-- current implementation ignores all other metadata -->
- <xsl:for-each select='*[not(self::title|self::subtitle|self::titleabbrev|self::author|self::releaseinfo)]'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match='title|subtitle|titleabbrev'>
- <w:p>
- <w:pPr>
- <w:pStyle>
- <xsl:attribute name='w:val'>
- <xsl:choose>
- <xsl:when test='(parent::section or
- parent::sectioninfo/parent::section) and
- count(ancestor::section) > 5'>
- <xsl:message>section nested deeper than 5 levels</xsl:message>
- <xsl:text>sect5-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:when>
- <xsl:when test='parent::section or
- parent::sectioninfo/parent::section'>
- <xsl:text>sect</xsl:text>
- <xsl:value-of select='count(ancestor::section)'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:when>
- <xsl:when test='contains(name(..), "info")'>
- <xsl:value-of select='name(../..)'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='name(..)'/>
- <xsl:text>-</xsl:text>
- <xsl:value-of select='name()'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </w:pStyle>
- <w:outlineLvl w:val='{count(ancestor::*) - count(parent::*[contains(name(), "info")]) - 1}'/>
- </w:pPr>
-
- <xsl:choose>
- <xsl:when test='contains(name(..), "info")'>
- <xsl:call-template name='attributes'>
- <xsl:with-param name='node' select='../..'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name='attributes'>
- <xsl:with-param name='node' select='..'/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:template>
-
- <doc:template name='metadata' xmlns=''>
- <title>Metadata</title>
-
- <para>TODO: Handle all metadata elements, apart from titles.</para>
- </doc:template>
- <xsl:template match='*[contains(name(), "info")]/*[not(self::title|self::subtitle|self::titleabbrev)]' priority='0'/>
-
- <xsl:template match='author|editor|othercredit'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='{name()}'/>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates select='personname|surname|firstname|honorific|lineage|othername|contrib'/>
- </w:p>
- <xsl:apply-templates select='affiliation|address'/>
- <xsl:apply-templates select='authorblurb|personblurb'/>
- </xsl:template>
- <xsl:template match='affiliation'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='affiliation'/>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:template>
- <xsl:template match='address[parent::author|parent::editor|parent::othercredit]'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='para-continue'/>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:template>
- <!-- do not attempt to handle recursive structures -->
- <xsl:template match='address[not(parent::author|parent::editor|parent::othercredit)]'>
- <xsl:apply-templates select='node()[not(self::affiliation|self::authorblurb)]'/>
- </xsl:template>
- <!-- TODO -->
- <xsl:template match='authorblurb|personblurb'/>
-
- <!-- TODO: handle inline markup (eg. emphasis) -->
- <xsl:template match='surname|firstname|honorific|lineage|othername|contrib|email|shortaffil|jobtitle|orgname|orgdiv|street|pob|postcode|city|state|country|phone|fax|citetitle'>
- <xsl:if test='preceding-sibling::*'>
- <w:r>
- <w:t>
- <xsl:text> </xsl:text>
- </w:t>
- </w:r>
- </xsl:if>
- <xsl:call-template name='handle-linebreaks'>
- <xsl:with-param name='style' select='name()'/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match='email'>
- <xsl:variable name='address'>
- <xsl:choose>
- <xsl:when test='starts-with(., "mailto:")'>
- <xsl:value-of select='.'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>mailto:</xsl:text>
- <xsl:value-of select='.'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <w:hlink w:dest='{$address}'>
- <xsl:call-template name='handle-linebreaks'>
- <xsl:with-param name='style'>Hyperlink</xsl:with-param>
- </xsl:call-template>
- </w:hlink>
- </xsl:template>
- <!-- otheraddr often contains ulink -->
- <xsl:template match='otheraddr'>
- <xsl:choose>
- <xsl:when test='ulink'>
- <xsl:for-each select='ulink'>
- <xsl:variable name='prev' select='preceding-sibling::ulink[1]'/>
- <xsl:choose>
- <xsl:when test='$prev'>
- <xsl:for-each
- select='preceding-sibling::node()[generate-id(following-sibling::ulink[1]) = generate-id(current())]'>
- <xsl:call-template name='handle-linebreaks'>
- <xsl:with-param name='style'>otheraddr</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test='preceding-sibling::node()'>
- <xsl:call-template name='handle-linebreaks'>
- <xsl:with-param name='style'>otheraddr</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- <xsl:apply-templates select='.'/>
- </xsl:for-each>
- <xsl:if test='ulink[last()]/following-sibling::node()'>
- <xsl:call-template name='handle-linebreaks'>
- <xsl:with-param name='text'
- select='ulink[last()]/following-sibling::node()'/>
- <xsl:with-param name='style'>otheraddr</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name='handle-linebreaks'>
- <xsl:with-param name='style'>otheraddr</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='ulink'>
- <w:hlink w:dest='{@url}'>
- <xsl:call-template name='handle-linebreaks'>
- <xsl:with-param name='style'>Hyperlink</xsl:with-param>
- </xsl:call-template>
- </w:hlink>
- </xsl:template>
-
- <!-- Cannot round-trip this element -->
- <xsl:template match='personname'>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match='releaseinfo'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='releaseinfo'/>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:template>
-
- <xsl:template match='para'>
- <xsl:param name='class'/>
-
- <xsl:variable name='block' select='blockquote|calloutlist|classsynopsis|funcsynopsis|figure|glosslist|graphic|informalfigure|informaltable|itemizedlist|literallayout|mediaobject|mediaobjectco|note|caution|warning|important|tip|orderedlist|programlisting|revhistory|segmentedlist|simplelist|table|variablelist'/>
-
- <xsl:choose>
- <xsl:when test='$block'>
- <w:p>
- <w:pPr>
- <w:pStyle>
- <xsl:attribute name='w:val'>
- <xsl:choose>
- <xsl:when test='$class != ""'>
- <xsl:value-of select='$class'/>
- </xsl:when>
- <xsl:otherwise>Normal</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </w:pStyle>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates select='$block[1]/preceding-sibling::node()'/>
- </w:p>
- <xsl:for-each select='$block'>
- <xsl:apply-templates select='.'/>
- <w:p>
- <w:pPr>
- <w:pStyle>
- <xsl:attribute name='w:val'>
- <xsl:choose>
- <xsl:when test='$class != ""'>
- <xsl:value-of select='$class'/>
- </xsl:when>
- <xsl:otherwise>Normal</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </w:pStyle>
- </w:pPr>
- <xsl:apply-templates select='following-sibling::node()[generate-id(preceding-sibling::*[self::blockquote|self::calloutlist|self::figure|self::glosslist|self::graphic|self::informalfigure|self::informaltable|self::itemizedlist|self::literallayout|self::mediaobject|self::mediaobjectco|self::note|self::caution|self::warning|self::important|self::tip|self::orderedlist|self::programlisting|self::revhistory|self::segmentedlist|self::simplelist|self::table|self::variablelist][1]) = generate-id(current())]'/>
- </w:p>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <w:p>
- <w:pPr>
- <w:pStyle>
- <xsl:attribute name='w:val'>
- <xsl:choose>
- <xsl:when test='$class != ""'>
- <xsl:value-of select='$class'/>
- </xsl:when>
- <xsl:otherwise>Normal</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </w:pStyle>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='simpara'>
- <xsl:param name='class'/>
-
- <w:p>
- <w:pPr>
- <w:pStyle>
- <xsl:attribute name='w:val'>
- <xsl:choose>
- <xsl:when test='$class != ""'>
- <xsl:value-of select='concat("sim-", $class)'/>
- </xsl:when>
- <xsl:otherwise>simpara</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </w:pStyle>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:template>
-
- <xsl:template match='emphasis'>
- <w:r>
- <w:rPr>
- <xsl:if test='@role = "bold" or @role = "strong"'>
- <w:b/>
- </xsl:if>
- <xsl:if test='not(@role)'>
- <w:i/>
- </xsl:if>
- </w:rPr>
- <w:t>
- <!-- TODO: use handle-linebreaks -->
- <xsl:value-of select='.'/>
- </w:t>
- </w:r>
- </xsl:template>
-
- <xsl:template match='informalfigure'>
- <xsl:if test='mediaobject/imageobject/imagedata'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='informalfigure-imagedata'/>
- </w:pPr>
- <xsl:call-template name='attributes'/>
-
- <w:r>
- <w:t>
- <xsl:apply-templates select='mediaobject/imageobject/imagedata/@fileref'
- mode='textonly'/>
- </w:t>
- </w:r>
- </w:p>
- </xsl:if>
- <xsl:for-each select='*[not(self::mediaobject)]'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match='mediaobject|mediaobjectco'>
- <xsl:apply-templates select='objectinfo/title'/>
- <xsl:apply-templates select='objectinfo/subtitle'/>
- <!-- TODO: indicate error for other children of objectinfo -->
-
- <xsl:apply-templates select='*[not(self::objectinfo)]'/>
- </xsl:template>
- <xsl:template match='imageobject|imageobjectco|audioobject|videoobject'>
- <xsl:apply-templates select='objectinfo/title'/>
- <xsl:apply-templates select='objectinfo/subtitle'/>
- <!-- TODO: indicate error for other children of objectinfo -->
-
- <xsl:apply-templates select='areaspec'/>
-
- <xsl:choose>
- <xsl:when test='imagedata|audiodata|videodata'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='{name()}-{name(imagedata|audiodata|videodata)}'/>
- </w:pPr>
- <xsl:call-template name='attributes'/>
-
- <w:r>
- <w:t>
- <xsl:apply-templates select='*/@fileref'
- mode='textonly'/>
- </w:t>
- </w:r>
- </w:p>
- </xsl:when>
- <xsl:when test='self::imageobjectco/imageobject/imagedata'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='{name()}-imagedata'/>
- </w:pPr>
- <xsl:call-template name='attributes'/>
-
- <w:r>
- <w:t>
- <xsl:apply-templates select='*/@fileref'
- mode='textonly'/>
- </w:t>
- </w:r>
- </w:p>
- </xsl:when>
- </xsl:choose>
- <xsl:apply-templates select='calloutlist'/>
-
- <xsl:for-each select='*[not(self::imageobject |
- self::imagedata |
- self::audiodata |
- self::videodata |
- self::areaspec |
- self::calloutlist)]'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match='textobject'>
- <xsl:choose>
- <xsl:when test='objectinfo/title|objectinfo|subtitle'>
- <xsl:apply-templates select='objectinfo/title'/>
- <xsl:apply-templates select='objectinfo/subtitle'/>
- <!-- TODO: indicate error for other children of objectinfo -->
- </xsl:when>
- <xsl:otherwise>
- <!-- synthesize a title so that the parent textobject
- can be recreated.
- -->
- <w:p>
- <w:pPr>
- <w:pStyle w:val='textobject-title'/>
- </w:pPr>
-
- <w:r>
- <w:t>
- <xsl:text>Text Object </xsl:text>
- <xsl:number level='any'/>
- </w:t>
- </w:r>
- </w:p>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:apply-templates select='*[not(self::objectinfo)]'/>
- </xsl:template>
-
- <xsl:template match='caption'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='caption'/>
- </w:pPr>
-
- <xsl:choose>
- <xsl:when test='not(*)'>
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select='para[1]/node()'/>
- <xsl:for-each select='text()|*[not(self::para)]|para[position() != 1]'>
- <xsl:call-template name='nomatch'/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </w:p>
- </xsl:template>
-
- <xsl:template match='areaspec'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='{name()}'/>
- </w:pPr>
- <xsl:call-template name='attributes'/>
-
- <w:r>
- <w:t></w:t>
- </w:r>
- </w:p>
- </xsl:template>
- <xsl:template match='area'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='{name()}'/>
- </w:pPr>
- <xsl:call-template name='attributes'/>
-
- <w:r>
- <w:t></w:t>
- </w:r>
- </w:p>
- </xsl:template>
-
- <xsl:template match='calloutlist'>
- <xsl:apply-templates select='callout'/>
- </xsl:template>
-
- <xsl:template match='callout'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='callout'/>
- </w:pPr>
- <xsl:call-template name='attributes'/>
-
- <!-- Normally a para would be the first child of a callout -->
- <xsl:apply-templates select='*[1][self::para]/node()' mode='list'/>
- </w:p>
- <!-- This is to catch the case where a listitem's first child is not a paragraph.
- - We may not be able to represent this properly.
- -->
- <xsl:apply-templates select='*[1][not(self::para)]' mode='list'/>
-
- <xsl:apply-templates select='*[position() != 1]' mode='list'/>
- </xsl:template>
-
- <xsl:template match='table|informaltable'>
-
- <w:tbl>
- <w:tblPr>
- <w:tblW w:w="0" w:type="auto"/>
- <w:tblInd w:w="108" w:type="dxa"/>
- <w:tblLayout w:type="Fixed"/>
- </w:tblPr>
- <w:tblGrid>
- <xsl:apply-templates select='tgroup/colspec' mode='column'/>
- </w:tblGrid>
- <xsl:apply-templates/>
- </w:tbl>
- </xsl:template>
-
- <xsl:template match='colspec' mode='column'>
- <w:gridcol w:w='{@colwidth}'/>
- </xsl:template>
-
- <xsl:template match='colspec'/>
-
- <xsl:template name='repeat'>
- <xsl:param name='repeats' select='0'/>
- <xsl:param name='content'/>
-
- <xsl:if test='$repeats > 0'>
- <xsl:copy-of select='$content'/>
- <xsl:call-template name='repeat'>
- <xsl:with-param name='repeats' select='$repeats - 1'/>
- <xsl:with-param name='content' select='$content'/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
- <xsl:template match='tgroup|tbody|thead'>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match='row'>
- <w:tr>
- <w:trPr>
- <xsl:if test='parent::thead'>
- <w:tblHeader/>
- </xsl:if>
- </w:trPr>
- <xsl:apply-templates/>
- </w:tr>
- </xsl:template>
-
- <xsl:template match='entry'>
-
- <!--
- Position = Sum(i,preceding-sibling[@colspan = ""]) + entry[i].@colspan)
- -->
-
- <xsl:variable name='position'>
- <xsl:call-template name='sumSibling'>
- <xsl:with-param name='sum' select='"1"'/>
- <xsl:with-param name='node' select='.'/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:variable name='limit' select='$position + @colspan'/>
- <w:tc>
- <w:tcPr>
- <xsl:choose>
- <xsl:when test='@colspan != ""'>
-
- <!-- Select all the colspec nodes which correspond to the
- column. That is all the nodes between the current
- column number and the column number plus the span.
- -->
-
- <xsl:variable name='combinedWidth'>
- <xsl:call-template name='sum'>
- <xsl:with-param name='nodes' select='ancestor::*[self::table|self::informaltable][1]/tgroup/colspec[not(position() < $position) and position() < $limit]'/>
- <xsl:with-param name='sum' select='"0"'/>
- </xsl:call-template>
- </xsl:variable>
- <w:tcW w:w='{$combinedWidth}' w:type='dxa'/>
- </xsl:when>
- <xsl:otherwise>
- <w:tcW w:w='{ancestor::*[self::table|self::informaltable][1]/tgroup/colspec[position() = $position]/@colwidth}' w:type='dxa'/>
- </xsl:otherwise>
- </xsl:choose>
-
- </w:tcPr>
- <xsl:if test='@hidden != ""'>
- <w:vmerge w:val=''/>
- </xsl:if>
- <xsl:if test='@rowspan != ""'>
- <w:vmerge w:val='restart'/>
- </xsl:if>
- <xsl:if test='@colspan != ""'>
- <w:gridspan w:val='{@colspan}'/>
- </xsl:if>
- <xsl:choose>
- <xsl:when test='not(para)'>
- <!-- TODO: check for any block elements -->
- <w:p>
- <xsl:apply-templates/>
- </w:p>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </w:tc>
- </xsl:template>
-
- <!-- Calculates the position by adding the
- count of the preceding siblings where they aren't colspans
- and adding the colspans of those entries which do.
- -->
-
- <xsl:template name='sumSibling'>
- <xsl:param name='sum'/>
- <xsl:param name='node'/>
-
- <xsl:variable name='add'>
- <xsl:choose>
- <xsl:when test='$node/preceding-sibling::entry/@colspan != ""'>
- <xsl:value-of select='$node/preceding-sibling::entry/@colspan'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='"1"'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test='count($node/preceding-sibling::entry) > 0'>
- <xsl:call-template name='sumSibling'>
- <xsl:with-param name='sum' select='$sum + $add'/>
- <xsl:with-param name='node' select='$node/preceding-sibling::entry[1]'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='$sum'/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
- <xsl:template name='sum'>
- <xsl:param name='sum' select='"0"'/>
- <xsl:param name='nodes'/>
-
- <xsl:variable name='tmpSum' select='$sum + $nodes[1]/@colwidth'/>
-
- <xsl:choose>
- <xsl:when test='count($nodes) > 1'>
- <xsl:call-template name='sum'>
- <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
- <xsl:with-param name='sum' select='$tmpSum'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select='$tmpSum'/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
- <xsl:template match='*[self::para|self::simpara]/text()[string-length(normalize-space(.)) != 0]'>
- <xsl:call-template name='handle-linebreaks'/>
- </xsl:template>
-
- <xsl:template match='text()[not(parent::para|parent::simpara|parent::literallayout|parent::programlisting)][string-length(normalize-space(.)) != 0]'>
- <xsl:call-template name='handle-linebreaks'/>
- </xsl:template>
- <xsl:template match='text()[string-length(normalize-space(.)) = 0]'/>
- <xsl:template match='literallayout/text()|programlisting/text()'>
- <xsl:call-template name='handle-linebreaks'/>
- </xsl:template>
- <xsl:template name='handle-linebreaks'>
- <xsl:param name='text' select='.'/>
- <xsl:param name='style'/>
-
- <xsl:choose>
- <xsl:when test='not($text)'/>
- <xsl:when test='contains($text, "
")'>
- <w:r>
- <xsl:if test='$style != ""'>
- <w:rPr>
- <w:rStyle w:val='{$style}'/>
- </w:rPr>
- </xsl:if>
- <w:t>
- <xsl:value-of select='substring-before($text, "
")'/>
- </w:t>
- </w:r>
- <xsl:call-template name='handle-linebreaks-aux'>
- <xsl:with-param name='text'
- select='substring-after($text, "
")'/>
- <xsl:with-param name='style' select='$style'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <w:r>
- <xsl:if test='$style != ""'>
- <w:rPr>
- <w:rStyle w:val='{$style}'/>
- </w:rPr>
- </xsl:if>
- <w:t>
- <xsl:value-of select='$text'/>
- </w:t>
- </w:r>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- pre-condition: leading linefeed has been stripped -->
- <xsl:template name='handle-linebreaks-aux'>
- <xsl:param name='text'/>
- <xsl:param name='style'/>
-
- <xsl:choose>
- <xsl:when test='contains($text, "
")'>
- <w:r>
- <xsl:if test='$style != ""'>
- <w:rPr>
- <w:rStyle w:val='{$style}'/>
- </w:rPr>
- </xsl:if>
- <w:br/>
- <w:t>
- <xsl:value-of select='substring-before($text, "
")'/>
- </w:t>
- </w:r>
- <xsl:call-template name='handle-linebreaks-aux'>
- <xsl:with-param name='text' select='substring-after($text, "
")'/>
- <xsl:with-param name='style' select='$style'/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <w:r>
- <xsl:if test='$style != ""'>
- <w:rPr>
- <w:rStyle w:val='{$style}'/>
- </w:rPr>
- </xsl:if>
- <w:br/>
- <w:t>
- <xsl:value-of select='$text'/>
- </w:t>
- </w:r>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match='authorblurb|formalpara|legalnotice|note|caution|warning|important|tip'>
- <xsl:apply-templates select='*'>
- <xsl:with-param name='class'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match='blockquote'>
- <xsl:apply-templates select='blockinfo|title'>
- <xsl:with-param name='class'>
- <xsl:value-of select='name()'/>
- </xsl:with-param>
- </xsl:apply-templates>
- <xsl:apply-templates select='*[not(self::blockinfo|self::title|self::attribution)]'>
- <xsl:with-param name='class' select='"blockquote"'/>
- </xsl:apply-templates>
- <xsl:if test='attribution'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='blockquote-attribution'/>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates select='attribution/node()'/>
- </w:p>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match='literallayout|programlisting'>
- <xsl:param name='class'/>
-
- <w:p>
- <w:pPr>
- <w:pStyle w:val='{name()}'/>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:template>
-
- <xsl:template match='bridgehead'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='bridgehead'/>
- </w:pPr>
-
- <xsl:call-template name='attributes'/>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:template>
-
- <xsl:template match='itemizedlist|orderedlist'>
- <xsl:apply-templates select='listitem'/>
- </xsl:template>
-
- <xsl:template match='listitem'>
- <w:p>
- <w:pPr>
- <!-- variablelist listitems are not handled here -->
- <w:pStyle w:val='{name(..)}{count(ancestor::itemizedlist|ancestor::orderedlist)}'/>
- <w:listPr>
- <wx:t wx:val='·'/>
- <wx:font wx:val='Symbol'/>
- </w:listPr>
- </w:pPr>
- <!-- Normally a para would be the first child of a listitem -->
- <xsl:apply-templates select='*[1][self::para]/node()' mode='list'/>
- </w:p>
- <!-- This is to catch the case where a listitem's first child is not a paragraph.
- - We may not be able to represent this properly.
- -->
- <xsl:apply-templates select='*[1][not(self::para)]' mode='list'/>
-
- <xsl:apply-templates select='*[position() != 1]' mode='list'/>
- </xsl:template>
-
- <xsl:template match='*' mode='list'>
- <xsl:apply-templates select='.'>
- <xsl:with-param name='class' select='"para-continue"'/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match='variablelist'>
- <xsl:apply-templates select='*[not(self::varlistentry)]'/>
-
- <w:tbl>
- <w:tblPr>
- <w:tblW w:w='0' w:type='auto'/>
- <w:tblInd w:w='108' w:type='dxa'/>
- <w:tblLayout w:type='Fixed'/>
- </w:tblPr>
- <w:tblGrid>
- <w:gridcol w:w='2160'/>
- <w:gridcol w:w='6480'/>
- </w:tblGrid>
- <xsl:apply-templates select='varlistentry'/>
- </w:tbl>
- </xsl:template>
- <xsl:template match='varlistentry'>
- <w:tr>
- <w:trPr>
- </w:trPr>
-
- <w:tc>
- <w:tcPr>
- <w:tcW w:w='2160' w:type='dxa'/>
- </w:tcPr>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='variablelist-term'/>
- </w:pPr>
- <xsl:apply-templates select='term[1]/node()'/>
- <xsl:for-each select='term[position() != 1]'>
- <w:r>
- <w:br/>
- </w:r>
- <xsl:apply-templates/>
- </xsl:for-each>
- </w:p>
- </w:tc>
- <w:tc>
- <w:tcPr>
- <w:tcW w:w='6480' w:type='dxa'/>
- </w:tcPr>
- <xsl:apply-templates select='listitem/node()'/>
- </w:tc>
- </w:tr>
- </xsl:template>
-
- <!-- These elements are not displayed.
- - However, they may need to be added (perhaps as hidden text)
- - for round-tripping.
- -->
- <xsl:template match='anchor|areaset|audiodata|audioobject|
- beginpage|
- constraint|
- indexterm|itermset|
- keywordset|
- msg'/>
-
- <xsl:template match='*' name='nomatch'>
- <xsl:message>
- <xsl:value-of select='name()'/>
- <xsl:text> encountered</xsl:text>
- <xsl:if test='parent::*'>
- <xsl:text> in </xsl:text>
- <xsl:value-of select='name(parent::*)'/>
- </xsl:if>
- <xsl:text>, but no template matches.</xsl:text>
- </xsl:message>
-
- <xsl:choose>
- <xsl:when test='self::abstract |
- self::ackno |
- self::address |
- self::answer |
- self::appendix |
- self::artheader |
- self::authorgroup |
- self::bibliodiv |
- self::biblioentry |
- self::bibliography |
- self::bibliomixed |
- self::bibliomset |
- self::biblioset |
- self::bridgehead |
- self::calloutlist |
- self::caption |
- self::classsynopsis |
- self::colophon |
- self::constraintdef |
- self::copyright |
- self::dedication |
- self::epigraph |
- self::equation |
- self::example |
- self::figure |
- self::funcsynopsis |
- self::glossary |
- self::glossdef |
- self::glossdiv |
- self::glossentry |
- self::glosslist |
- self::graphic |
- self::highlights |
- self::imageobject |
- self::imageobjectco |
- self::index |
- self::indexdiv |
- self::indexentry |
- self::informalequation |
- self::informalexample |
- self::informalfigure |
- self::lot |
- self::lotentry |
- self::mediaobject |
- self::mediaobjectco |
- self::member |
- self::msgentry |
- self::msgset |
- self::part |
- self::partintro |
- self::personblurb |
- self::preface |
- self::printhistory |
- self::procedure |
- self::programlisting |
- self::programlistingco |
- self::publisher |
- self::qandadiv |
- self::qandaentry |
- self::qandaset |
- self::question |
- self::refdescriptor |
- self::refentry |
- self::refentrytitle |
- self::reference |
- self::refmeta |
- self::refname |
- self::refnamediv |
- self::refpurpose |
- self::refsect1 |
- self::refsect2 |
- self::refsect3 |
- self::refsection |
- self::refsynopsisdiv |
- self::screen |
- self::screenco |
- self::screenshot |
- self::seg |
- self::seglistitem |
- self::segmentedlist |
- self::segtitle |
- self::set |
- self::setindex |
- self::sidebar |
- self::simplelist |
- self::simplemsgentry |
- self::step |
- self::stepalternatives |
- self::subjectset |
- self::substeps |
- self::task |
- self::textobject |
- self::toc |
- self::videodata |
- self::videoobject |
- self::*[not(starts-with(name(), "informal")) and contains(name(), "info")]'>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='blockerror'/>
- </w:pPr>
- <w:r>
- <w:t>
- <xsl:value-of select='name()'/>
- <xsl:text> encountered</xsl:text>
- <xsl:if test='parent::*'>
- <xsl:text> in </xsl:text>
- <xsl:value-of select='name(parent::*)'/>
- </xsl:if>
- <xsl:text>, but no template matches.</xsl:text>
- </w:t>
- </w:r>
- </w:p>
- </xsl:when>
- <!-- Some elements are sometimes blocks, sometimes inline
- <xsl:when test='self::affiliation |
- self::alt |
- self::attribution |
- self::collab |
- self::collabname |
- self::confdates |
- self::confgroup |
- self::confnum |
- self::confsponsor |
- self::conftitle |
- self::contractnum |
- self::contractsponsor |
- self::contrib |
- self::corpauthor |
- self::corpcredit |
- self::corpname |
- self::edition |
- self::editor |
- self::jobtitle |
- self::personname |
- self::publishername |
- self::remark'>
-
- </xsl:when>
- -->
- <xsl:otherwise>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='inlineerror'/>
- </w:rPr>
- <w:t>
- <xsl:value-of select='name()'/>
- <xsl:text> encountered</xsl:text>
- <xsl:if test='parent::*'>
- <xsl:text> in </xsl:text>
- <xsl:value-of select='name(parent::*)'/>
- </xsl:if>
- <xsl:text>, but no template matches.</xsl:text>
- </w:t>
- </w:r>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name='attributes'>
- <xsl:param name='node' select='.'/>
-
- <xsl:if test='$node/@*'>
- <aml:annotation aml:id='{count(preceding::*) + 1}' w:type='Word.Comment.Start'/>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='attributes'/>
- </w:rPr>
- <w:t>
- <xsl:text> </xsl:text>
- </w:t>
- </w:r>
- <aml:annotation aml:id='{count(preceding::*) + 1}' w:type='Word.Comment.End'/>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='CommentReference'/>
- </w:rPr>
- <aml:annotation aml:id='{count(preceding::*) + 1}' aml:author="DocBook" aml:createdate='2004-12-23T00:01:00' w:type='Word.Comment' w:initials='DBK'>
- <aml:content>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='CommentText'/>
- </w:pPr>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='CommentReference'/>
- </w:rPr>
- <w:annotationRef/>
- </w:r>
- <xsl:for-each select='$node/@*'>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='attribute-name'/>
- </w:rPr>
- <w:t>
- <xsl:value-of select='name()'/>
- </w:t>
- </w:r>
- <w:r>
- <w:t>=</w:t>
- </w:r>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='attribute-value'/>
- </w:rPr>
- <w:t>
- <xsl:value-of select='.'/>
- </w:t>
- </w:r>
- </xsl:for-each>
- </w:p>
- </aml:content>
- </aml:annotation>
- </w:r>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match='*' mode='copy'>
- <xsl:copy>
- <xsl:for-each select='@*'>
- <xsl:copy/>
- </xsl:for-each>
- <xsl:apply-templates mode='copy'/>
- </xsl:copy>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-
- xmlns:sfa="http://developer.apple.com/namespaces/sfa"
- xmlns:sf="http://developer.apple.com/namespaces/sf"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:appsl="http://developer.apple.com/namespaces/sl"
-
- 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:node='http://xsltsl.org/node'
- xmlns:doc='http://www.oasis-open.org/docbook/xml/4.0'
- extension-element-prefixes='node'
- exclude-result-prefixes='doc sfa sf xsi appsl'>
-
- <xsl:import href='xsltsl/stdlib.xsl'/>
-
- <xsl:output method="xml" indent='yes'/>
-
- <!-- ********************************************************************
- $Id$
- ********************************************************************
-
- This file is part of the XSL DocBook Stylesheet distribution.
- See ../README or http://docbook.sf.net/release/xsl/current/ for
- copyright and other information.
-
- ******************************************************************** -->
-
- <xsl:strip-space elements='*'/>
- <xsl:preserve-space elements='sf:span'/>
-
- <xsl:key name='styles'
- match='sf:paragraphstyle[not(ancestor::appsl:section-prototypes)] |
- sf:characterstyle[not(ancestor::appsl:section-prototypes)]'
- use='@sf:ident|@sfa:ID'/>
-
- <xsl:template match='appsl:document'>
- <w:wordDocument>
- <!-- TODO: headers and footers -->
- <xsl:apply-templates select='sf:text-storage'/>
- </w:wordDocument>
- </xsl:template>
-
- <xsl:template match='sf:text-body'>
- <w:body>
- <xsl:apply-templates/>
- </w:body>
- </xsl:template>
-
- <xsl:template match='sf:text-storage'>
- <wx:sect>
- <wx:sub-section>
- <xsl:apply-templates/>
- </wx:sub-section>
- </wx:sect>
- </xsl:template>
-
- <xsl:template match='sf:p'>
- <w:p>
- <xsl:call-template name='find-style'/>
-
- <xsl:apply-templates/>
- </w:p>
- </xsl:template>
-
- <xsl:template match='sf:span'>
- <xsl:variable name='style-name'
- select='key("styles", @sf:style)/self::sf:characterstyle/@sf:name'/>
-
- <xsl:choose>
- <xsl:when test='$style-name = "attribute-name"'>
- <xsl:if test='not(preceding-sibling::node()[not(self::text()) or (self::text() and normalize-space() != "")])'>
- <aml:annotation aml:id='25' w:type='Word.Comment.Start'/>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='attributes'/>
- </w:rPr>
- <w:t>
- <xsl:text> </xsl:text>
- </w:t>
- </w:r>
- <aml:annotation aml:id='25' w:type='Word.Comment.End'/>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='CommentReference'/>
- </w:rPr>
- <aml:annotation aml:id='25' aml:author='DocBook' aml:createdate='2004-12-23T00:01:00' w:type='Word.Comment' w:initials='DBK'>
- <aml:content>
- <w:p>
- <w:pPr>
- <w:pStyle w:val='CommentText'/>
- </w:pPr>
- <w:r>
- <w:rPr>
- <w:rStyle w:val="CommentReference"/>
- </w:rPr>
- <w:annotationRef/>
- </w:r>
- <xsl:call-template name='make-attributes'/>
- </w:p>
- </aml:content>
- </aml:annotation>
- </w:r>
- </xsl:if>
- </xsl:when>
- <xsl:when test='$style-name = "attribute-value"'/>
- <xsl:otherwise>
- <w:r>
- <xsl:call-template name='find-style'>
- <xsl:with-param name='char-style-name' select='$style-name'/>
- </xsl:call-template>
-
- <xsl:apply-templates/>
- </w:r>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- Precondition: $node is a sf:span with style "attribute-name" -->
- <xsl:template name='make-attributes'>
- <xsl:param name='node' select='.'/>
-
- <xsl:choose>
- <xsl:when test='not($node)'/>
- <xsl:when test='$node/following-sibling::node()[1][self::sf:span]'>
- <xsl:if test='key("styles", $node/following-sibling::*[1]/@sf:style)/self::sf:characterstyle/@sf:name = "attribute-value"'>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='attribute-name'/>
- </w:rPr>
- <w:t>
- <xsl:apply-templates select='$node' mode='textonly'/>
- </w:t>
- </w:r>
- <w:r><w:t>=</w:t></w:r>
- <w:r>
- <w:rPr>
- <w:rStyle w:val='attribute-value'/>
- </w:rPr>
- <w:t>
- <xsl:apply-templates select='$node/following-sibling::*[1]'
- mode='textonly'/>
- </w:t>
- </w:r>
- <xsl:if test='$node/following-sibling::node()[2][self::sf:span] and
- key("styles", $node/following-sibling::*[2]/@sf:style)/self::sf:characterstyle/@sf:name = "attribute-name"'>
- <xsl:call-template name='make-attributes'>
- <xsl:with-param name='node' select='$node/following-sibling::*[2]'/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match='sf:br'/>
- <xsl:template match='sf:lnbr|sf:crbr'>
- <w:r>
- <w:br/>
- </w:r>
- </xsl:template>
- <xsl:template match='sf:tab'>
- <xsl:text> </xsl:text>
- </xsl:template>
- <xsl:template match='sf:link'>
- <w:hlink w:dest='{@href}'>
- <xsl:apply-templates/>
- </w:hlink>
- </xsl:template>
-
- <xsl:template match='text()'>
- <xsl:choose>
- <xsl:when test='ancestor::sf:span'>
- <w:t>
- <xsl:value-of select='.'/>
- </w:t>
- </xsl:when>
- <xsl:otherwise>
- <w:r>
- <xsl:if test='ancestor::sf:link'>
- <w:rPr>
- <w:rStyle w:val='Hyperlink'/>
- </w:rPr>
- </xsl:if>
- <w:t>
- <xsl:value-of select='.'/>
- </w:t>
- </w:r>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match='sf:section|sf:layout'>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match='sf:stylesheet|sf:stylesheet-ref |
- sf:container-hint |
- sf:page-start|sf:br |
- sf:selection-start|sf:selection-end |
- sf:insertion-point |
- sf:ghost-text'/>
-
- <xsl:template match='*'>
- <xsl:message>element "<xsl:value-of select='name()'/>" not handled</xsl:message>
- </xsl:template>
-
- <xsl:template name='find-style'>
- <xsl:param name='ident' select='@sf:style'/>
- <xsl:param name='para-style-name'
- select='key("styles", $ident)/self::sf:paragraphstyle/@sf:name'/>
- <xsl:param name='char-style-name'
- select='key("styles", $ident)/self::sf:characterstyle/@sf:name'/>
-
- <xsl:choose>
- <xsl:when test='$ident = "paragraph-style-default"'>
- <w:pPr>
- <w:pStyle w:val='Normal'/>
- </w:pPr>
- </xsl:when>
- <xsl:when test='$para-style-name != ""'>
- <w:pPr>
- <xsl:if test='$para-style-name != ""'>
- <w:pStyle w:val='{$para-style-name}'/>
- </xsl:if>
- </w:pPr>
- </xsl:when>
- <xsl:when test='$char-style-name != "" or
- key("styles", $ident)/self::sf:characterstyle/sf:property-map/*'>
- <w:rPr>
- <xsl:if test='$char-style-name != ""'>
- <w:rStyle w:val='{$char-style-name}'/>
- </xsl:if>
- <xsl:apply-templates select='key("styles", $ident)/self::sf:characterstyle/sf:property-map/*'
- mode='styles'/>
- </w:rPr>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match='sf:bold' mode='styles'>
- <w:b/>
- </xsl:template>
- <xsl:template match='sf:italic' mode='styles'>
- <w:i/>
- </xsl:template>
- <xsl:template match='sf:underline' mode='styles'>
- <w:u/>
- </xsl:template>
-
-</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">
-<!--====================================-->
-<!--= =-->
-<!--= This stylesheet is GENERATED =-->
-<!--= by makeSections.xsl and a =-->
-<!--= mapping specification. =-->
-<!--= =-->
-<!--= IF YOU EDIT THIS STYLESHEET =-->
-<!--= YOUR CHANGES WILL GET =-->
-<!--= OVERWRITTEN!! =-->
-<!--= =-->
-<!--= Revision history: =-->
-<!--= 1.0 2005-11-08 SRB =-->
-<!--= Initial version. =-->
-<!--= =-->
-<!--= $Id$ =-->
-<!--= =-->
-<!--====================================-->
- <axsl:output indent="yes" encoding="utf-8"/>
- <axsl:strip-space elements="*"/>
- <axsl:preserve-space elements="w:t"/>
- <axsl:template match="wx:sub-section">
- <axsl:variable name="subsections" select="w:p[w:pPr/w:pStyle/@w:val = "bibliography" or w:pPr/w:pStyle/@w:val = "bibliography-title" or w:pPr/w:pStyle/@w:val = "glossary" or w:pPr/w:pStyle/@w:val = "glossary-title" or w:pPr/w:pStyle/@w:val = "qandaset" or w:pPr/w:pStyle/@w:val = "qandaset-title"]"/>
- <axsl:copy>
- <axsl:apply-templates select="@*"/>
- <axsl:choose>
- <axsl:when test="$subsections">
- <axsl:apply-templates select="$subsections[1]/preceding-sibling::node()"/>
- <axsl:apply-templates select="$subsections[1]" mode="subsections">
- <axsl:with-param name="subsections" select="$subsections[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- <axsl:when test="wx:sub-section">
- <axsl:apply-templates select="wx:sub-section[1]/preceding-sibling::node()"/>
- <axsl:apply-templates select="wx:sub-section"/>
- </axsl:when>
- <axsl:otherwise>
- <axsl:apply-templates/>
- </axsl:otherwise>
- </axsl:choose>
- </axsl:copy>
- <axsl:choose>
- <axsl:when test="following-sibling::wx:sub-section | following-sibling::w:p[w:pPr/w:pStyle/@w:val = "bibliography" or w:pPr/w:pStyle/@w:val = "bibliography-title" or w:pPr/w:pStyle/@w:val = "glossary" or w:pPr/w:pStyle/@w:val = "glossary-title" or w:pPr/w:pStyle/@w:val = "qandaset" or w:pPr/w:pStyle/@w:val = "qandaset-title"]">
- <axsl:variable name="nextComponent" select="following-sibling::*[self::wx:sub-section|self::w:p[w:pPr/w:pStyle/@w:val = "bibliography" or w:pPr/w:pStyle/@w:val = "bibliography-title" or w:pPr/w:pStyle/@w:val = "glossary" or w:pPr/w:pStyle/@w:val = "glossary-title" or w:pPr/w:pStyle/@w:val = "qandaset" or w:pPr/w:pStyle/@w:val = "qandaset-title"]][1]"/>
- <axsl:apply-templates select="following-sibling::*[generate-id(following-sibling::*[self::wx:sub-section|self::w:p[w:pPr/w:pStyle/@w:val = "bibliography" or w:pPr/w:pStyle/@w:val = "bibliography-title" or w:pPr/w:pStyle/@w:val = "glossary" or w:pPr/w:pStyle/@w:val = "glossary-title" or w:pPr/w:pStyle/@w:val = "qandaset" or w:pPr/w:pStyle/@w:val = "qandaset-title"]][1]) = generate-id($nextComponent)]"/>
- </axsl:when>
- <axsl:otherwise>
- <axsl:apply-templates select="following-sibling::*"/>
- </axsl:otherwise>
- </axsl:choose>
- </axsl:template>
- <axsl:template match="w:p" mode="subsections">
- <axsl:param name="subsections" select="/.."/>
- <axsl:choose>
- <axsl:when test="w:pPr/w:pStyle/@w:val = "bibliography" or w:pPr/w:pStyle/@w:val = "bibliography-title"">
- <wx:sub-section class="bibliography">
- <axsl:call-template name="copy"/>
- <axsl:variable name="bibliodivs" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "bibliodiv" or w:pPr/w:pStyle/@w:val = "bibliodiv-title"]"/>
- <axsl:choose>
- <axsl:when test="$bibliodivs">
- <axsl:apply-templates select="following-sibling::*[1]" mode="bibliodivs">
- <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
- <axsl:with-param name="bibliodivs" select="$bibliodivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- <axsl:otherwise>
- <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
- <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
- </axsl:apply-templates>
- </axsl:otherwise>
- </axsl:choose>
- </wx:sub-section>
- </axsl:when>
- <axsl:when test="w:pPr/w:pStyle/@w:val = "glossary" or w:pPr/w:pStyle/@w:val = "glossary-title"">
- <wx:sub-section class="glossary">
- <axsl:call-template name="copy"/>
- <axsl:variable name="glossdivs" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "glossdiv" or w:pPr/w:pStyle/@w:val = "glossdiv-title"]"/>
- <axsl:choose>
- <axsl:when test="$glossdivs">
- <axsl:apply-templates select="following-sibling::*[1]" mode="glossdivs">
- <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
- <axsl:with-param name="glossdivs" select="$glossdivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- <axsl:otherwise>
- <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
- <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
- </axsl:apply-templates>
- </axsl:otherwise>
- </axsl:choose>
- </wx:sub-section>
- </axsl:when>
- <axsl:when test="w:pPr/w:pStyle/@w:val = "qandaset" or w:pPr/w:pStyle/@w:val = "qandaset-title"">
- <wx:sub-section class="qandaset">
- <axsl:call-template name="copy"/>
- <axsl:variable name="qandadivs" select="following-sibling::w:p[w:pPr/w:pStyle/@w:val = "qandadiv" or w:pPr/w:pStyle/@w:val = "qandadiv-title"]"/>
- <axsl:choose>
- <axsl:when test="$qandadivs">
- <axsl:apply-templates select="following-sibling::*[1]" mode="qandadivs">
- <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
- <axsl:with-param name="qandadivs" select="$qandadivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- <axsl:otherwise>
- <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
- <axsl:with-param name="nextSubsection" select="$subsections[1]"/>
- </axsl:apply-templates>
- </axsl:otherwise>
- </axsl:choose>
- </wx:sub-section>
- </axsl:when>
- </axsl:choose>
- </axsl:template>
- <axsl:template match="*" mode="subsections">
- <axsl:param name="subsections" select="/.."/>
- <axsl:copy>
- <axsl:apply-templates select="@*"/>
- <axsl:apply-templates mode="subsections"/>
- </axsl:copy>
- </axsl:template>
- <axsl:template match="w:p" mode="bibliodivs">
- <axsl:param name="nextSubsection" select="/.."/>
- <axsl:param name="bibliodivs" select="/.."/>
- <axsl:choose>
- <axsl:when test="generate-id() = generate-id($nextSubsection)"/>
- <axsl:when test="w:pPr/w:pStyle/@w:val = "bibliodiv" or w:pPr/w:pStyle/@w:val = "bibliodiv-title"">
- <wx:sub-section class="bibliodiv">
- <axsl:call-template name="copy"/>
- <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- <axsl:with-param name="nextbibliodiv" select="$bibliodivs[1]"/>
- </axsl:apply-templates>
- </wx:sub-section>
- <axsl:choose>
- <axsl:when test="$nextSubsection and $bibliodivs and count($nextSubsection/preceding-sibling::* | $bibliodivs[1]) = count($nextSubsection/preceding-sibling::*)">
- <axsl:apply-templates select="$bibliodivs[1]" mode="bibliodivs">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- <axsl:with-param name="bibliodivs" select="$bibliodivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- <axsl:when test="$bibliodivs">
- <axsl:apply-templates select="$bibliodivs[1]" mode="bibliodivs">
- <axsl:with-param name="bibliodivs" select="$bibliodivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- </axsl:choose>
- </axsl:when>
- <axsl:otherwise>
- <axsl:call-template name="copy"/>
- <axsl:apply-templates select="following-sibling::*[1]" mode="bibliodivs">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- </axsl:apply-templates>
- </axsl:otherwise>
- </axsl:choose>
- </axsl:template>
- <axsl:template match="w:p" mode="glossdivs">
- <axsl:param name="nextSubsection" select="/.."/>
- <axsl:param name="glossdivs" select="/.."/>
- <axsl:choose>
- <axsl:when test="generate-id() = generate-id($nextSubsection)"/>
- <axsl:when test="w:pPr/w:pStyle/@w:val = "glossdiv" or w:pPr/w:pStyle/@w:val = "glossdiv-title"">
- <wx:sub-section class="glossdiv">
- <axsl:call-template name="copy"/>
- <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- <axsl:with-param name="nextglossdiv" select="$glossdivs[1]"/>
- </axsl:apply-templates>
- </wx:sub-section>
- <axsl:choose>
- <axsl:when test="$nextSubsection and $glossdivs and count($nextSubsection/preceding-sibling::* | $glossdivs[1]) = count($nextSubsection/preceding-sibling::*)">
- <axsl:apply-templates select="$glossdivs[1]" mode="glossdivs">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- <axsl:with-param name="glossdivs" select="$glossdivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- <axsl:when test="$glossdivs">
- <axsl:apply-templates select="$glossdivs[1]" mode="glossdivs">
- <axsl:with-param name="glossdivs" select="$glossdivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- </axsl:choose>
- </axsl:when>
- <axsl:otherwise>
- <axsl:call-template name="copy"/>
- <axsl:apply-templates select="following-sibling::*[1]" mode="glossdivs">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- </axsl:apply-templates>
- </axsl:otherwise>
- </axsl:choose>
- </axsl:template>
- <axsl:template match="w:p" mode="qandadivs">
- <axsl:param name="nextSubsection" select="/.."/>
- <axsl:param name="qandadivs" select="/.."/>
- <axsl:choose>
- <axsl:when test="generate-id() = generate-id($nextSubsection)"/>
- <axsl:when test="w:pPr/w:pStyle/@w:val = "qandadiv" or w:pPr/w:pStyle/@w:val = "qandadiv-title"">
- <wx:sub-section class="qandadiv">
- <axsl:call-template name="copy"/>
- <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- <axsl:with-param name="nextqandadiv" select="$qandadivs[1]"/>
- </axsl:apply-templates>
- </wx:sub-section>
- <axsl:choose>
- <axsl:when test="$nextSubsection and $qandadivs and count($nextSubsection/preceding-sibling::* | $qandadivs[1]) = count($nextSubsection/preceding-sibling::*)">
- <axsl:apply-templates select="$qandadivs[1]" mode="qandadivs">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- <axsl:with-param name="qandadivs" select="$qandadivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- <axsl:when test="$qandadivs">
- <axsl:apply-templates select="$qandadivs[1]" mode="qandadivs">
- <axsl:with-param name="qandadivs" select="$qandadivs[position() != 1]"/>
- </axsl:apply-templates>
- </axsl:when>
- </axsl:choose>
- </axsl:when>
- <axsl:otherwise>
- <axsl:call-template name="copy"/>
- <axsl:apply-templates select="following-sibling::*[1]" mode="qandadivs">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- </axsl:apply-templates>
- </axsl:otherwise>
- </axsl:choose>
- </axsl:template>
- <axsl:template match="*" mode="terminal">
- <axsl:param name="nextSubsection" select="/.."/>
- <axsl:param name="nextbibliodiv" select="/.."/>
- <axsl:param name="nextglossdiv" select="/.."/>
- <axsl:param name="nextqandadiv" select="/.."/>
- <axsl:choose>
- <axsl:when test="generate-id() = generate-id($nextSubsection)"/>
- <axsl:when test="generate-id() = generate-id($nextbibliodiv)"/>
- <axsl:when test="generate-id() = generate-id($nextglossdiv)"/>
- <axsl:when test="generate-id() = generate-id($nextqandadiv)"/>
- <axsl:otherwise>
- <axsl:call-template name="copy"/>
- <axsl:apply-templates select="following-sibling::*[1]" mode="terminal">
- <axsl:with-param name="nextSubsection" select="$nextSubsection"/>
- <axsl:with-param name="nextbibliodiv" select="$nextbibliodiv"/>
- <axsl:with-param name="nextglossdiv" select="$nextglossdiv"/>
- <axsl:with-param name="nextqandadiv" select="$nextqandadiv"/>
- </axsl:apply-templates>
- </axsl:otherwise>
- </axsl:choose>
- </axsl:template>
- <axsl:template match="*">
- <axsl:copy>
- <axsl:apply-templates select="@*"/>
- <axsl:apply-templates/>
- </axsl:copy>
- </axsl:template>
- <axsl:template name="copy">
- <axsl:copy>
- <axsl:apply-templates select="@*"/>
- <axsl:apply-templates/>
- </axsl:copy>
- </axsl:template>
- <axsl:template match="@*">
- <axsl:copy/>
- </axsl:template>
-</axsl:stylesheet>
+++ /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 wordlist 'w:p[w:pPr/w:listPr/w:ilvl/@w:val = "0" and
- w:pPr/w:listPr/wx:t/@wx:val = "·" and
- w:pPr/w:listPr/wx:font/@wx:val = "Symbol"]'>
-
-<!ENTITY itemizedlist 'w:p[starts-with(w:pPr/w:pStyle/@w:val,"itemizedlist") or
- (w:pPr/w:listPr/w:ilvl/@w:val = "0" and
- w:pPr/w:listPr/wx:t/@wx:val = "·" and
- w:pPr/w:listPr/wx:font/@wx:val = "Symbol")]'>
-<!ENTITY itemizedlist1 'w:p[w:pPr/w:pStyle/@w:val = "itemizedlist1" or
- (w:pPr/w:listPr/w:ilvl/@w:val = "0" and
- w:pPr/w:listPr/wx:t/@wx:val = "·" and
- w:pPr/w:listPr/wx:font/@wx:val = "Symbol")]'>
-<!ENTITY orderedlist "w:p[w:pPr/w:pStyle[starts-with(@w:val,'orderedlist')]]">
-<!ENTITY orderedlist1 "w:p[w:pPr/w:pStyle[@w:val = 'orderedlist' or
- @w:val = 'orderedlist1']]">
-
-<!ENTITY variablelist "w:tbl[w:tblPr/w:tblStyle[starts-with(@w:val,'variablelist')]]">
-
-<!ENTITY calloutlist "w:p[w:pPr/w:pStyle[@w:val = 'calloutlist']]">
-<!ENTITY callout "w:p[w:pPr/w:pStyle[@w:val = 'callout']]">
-<!ENTITY areaspec "w:p[w:pPr/w:pStyle[@w:val = 'areaspec']]">
-<!ENTITY area "w:p[w:pPr/w:pStyle[@w:val = 'area']]">
-
-<!ENTITY highlights "w:p[w:pPr/w:pStyle[starts-with(@w:val,'highlights')]]">
-
-<!ENTITY verbatim "w:p[w:pPr/w:pStyle[@w:val='programlisting' or @w:val='screen' or @w:val='literallayout']]">
-<!ENTITY programlisting "w:p[w:pPr/w:pStyle[@w:val='programlisting']]">
-<!ENTITY programlistingco "w:p[w:pPr/w:pStyle[@w:val='programlistingco']]">
-<!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='figure-title']]">
-<!ENTITY figurecaption "w:p[w:pPr/w:pStyle[@w:val='figure-title']]">
-<!ENTITY tabletitle "w:p[w:pPr/w:pStyle[@w:val='table-title']]">
-<!ENTITY exampletitle "w:p[w:pPr/w:pStyle[@w:val='example-title']]">
-<!ENTITY mediaobjecttitle "w:p[w:pPr/w:pStyle[@w:val='mediaobject-title']]">
-<!ENTITY mediaobjectcotitle "w:p[w:pPr/w:pStyle[@w:val='mediaobjectco-title']]">
-<!ENTITY imageobject "w:p[w:pPr/w:pStyle[@w:val='imageobject-imagedata']]">
-<!ENTITY imageobjectco "w:p[w:pPr/w:pStyle[@w:val='imageobjectco-imagedata']]">
-<!ENTITY audioobject "w:p[w:pPr/w:pStyle[@w:val='audioobject-audiodata']]">
-<!ENTITY videoobject "w:p[w:pPr/w:pStyle[@w:val='videoobject-videodata']]">
-<!ENTITY textobjecttitle "w:p[w:pPr/w:pStyle[@w:val='textobject-title']]">
-<!ENTITY caption "w:p[w:pPr/w:pStyle[@w:val='caption']]">
-<!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']]">
-<!ENTITY bridgehead "w:p[w:pPr/w:pStyle[@w:val='bridgehead']]">
-
-<!ENTITY biblioentrytitle "w:p[w:pPr/w:pStyle[@w:val='biblioentry-title']]">
-<!ENTITY bibliomisc.style "w:pPr/w:pStyle[@w:val='bibliomisc']">
-<!ENTITY bibliomisc "w:p[&bibliomisc.style;]">
-<!ENTITY bibliorelation.style "w:pPr/w:pStyle[@w:val='bibliorelation']">
-<!ENTITY bibliorelation "w:p[&bibliorelation.style;]">
-
-<!ENTITY glossterm "w:p[w:pPr/w:pStyle[@w:val='glossterm']]">
-
-<!ENTITY qandasettitle "w:p[w:pPr/w:pStyle[@w:val='qandaset-title']]">
-<!ENTITY qandadivtitle "w:p[w:pPr/w:pStyle[@w:val='qandadiv-title']]">
-<!ENTITY question "w:p[w:pPr/w:pStyle[@w:val='question']]">
-<!ENTITY answer "w:p[w:pPr/w:pStyle[@w:val='answer']]">
-
-<!ENTITY releaseinfo.style "w:pPr/w:pStyle/@w:val='releaseinfo'">
-<!ENTITY releaseinfo "w:p[&releaseinfo.style;]">
-<!ENTITY revhistory.style "w:pPr/w:pStyle/@w:val='revhistory'">
-<!ENTITY revhistory "w:p[&revhistory.style;]">
-<!ENTITY revision.style "w:pPr/w:pStyle/@w:val='revision'">
-<!ENTITY revision "w:p[&revision.style;]">
-<!ENTITY revremark.style "w:pPr/w:pStyle/@w:val='revremark'">
-<!ENTITY revremark "w:p[&revremark.style;]">
-<!ENTITY affiliation.style "w:pPr/w:pStyle/@w:val='affiliation'">
-<!ENTITY affiliation "w:p[&affiliation.style;]">
-<!ENTITY author.style "w:pPr/w:pStyle/@w:val='author'">
-<!ENTITY author "w:p[&author.style;]">
-<!ENTITY editor.style "w:pPr/w:pStyle/@w:val='editor'">
-<!ENTITY editor "w:p[&editor.style;]">
-<!ENTITY othercredit.style "w:pPr/w:pStyle/@w:val='othercredit'">
-<!ENTITY othercredit "w:p[&othercredit.style;]">
-<!ENTITY authorblurb.style "w:pPr/w:pStyle/@w:val='authorblurb'">
-<!ENTITY authorblurb "w:p[&authorblurb.style;]">
-<!ENTITY address.style "w:pPr/w:pStyle/@w:val='address'">
-<!ENTITY address "w:p[&address.style;]">
-<!ENTITY publishername.style "w:pPr/w:pStyle/@w:val='publishername'">
-<!ENTITY publishername "w:p[&publishername.style;]">
-<!ENTITY isbn.style "w:pPr/w:pStyle/@w:val='isbn'">
-<!ENTITY isbn "w:p[&isbn.style;]">
-
-<!ENTITY abstracttitle.style "w:pPr/w:pStyle/@w:val='abstract-title'">
-<!ENTITY abstracttitle "w:p[&abstracttitle.style;]">
-<!ENTITY abstract.style "w:pPr/w:pStyle/@w:val='abstract'">
-<!ENTITY abstract "w:p[&abstract.style;]">
-
-<!ENTITY metadata.element.style "&releaseinfo.style; or
- &affiliation.style; or
- &authorblurb.style; or
- &author.style; or
- &editor.style; or
- &othercredit.style; or
- &revhistory.style; or
- &revision.style; or
- &abstracttitle.style; or
- &abstract.style; or
- &bibliomisc.style; or
- &bibliorelation.style; or
- &address.style; or
- &publishername.style; or
- &isbn.style;">
-<!ENTITY metadata.elements "w:p[&metadata.element.style;]">
-
-<!ENTITY xinclude "w:p[w:pPr/w:pStyle/@w:val='xinclude']">
-
-<!ENTITY surname "w:r[w:rPr/w:rStyle/@w:val='surname']">
-<!ENTITY firstname "w:r[w:rPr/w:rStyle/@w:val='firstname']">
-<!ENTITY honorific "w:r[w:rPr/w:rStyle/@w:val='honorific']">
-<!ENTITY lineage "w:r[w:rPr/w:rStyle/@w:val='lineage']">
-<!ENTITY othername "w:r[w:rPr/w:rStyle/@w:val='othername']">
-<!ENTITY contrib "w:r[w:rPr/w:rStyle/@w:val='contrib']">
-<!ENTITY street "w:r[w:rPr/w:rStyle/@w:val='street']">
-<!ENTITY pob "w:r[w:rPr/w:rStyle/@w:val='pob']">
-<!ENTITY postcode "w:r[w:rPr/w:rStyle/@w:val='postcode']">
-<!ENTITY city "w:r[w:rPr/w:rStyle/@w:val='city']">
-<!ENTITY state "w:r[w:rPr/w:rStyle/@w:val='state']">
-<!ENTITY country "w:r[w:rPr/w:rStyle/@w:val='country']">
-<!ENTITY phone "w:r[w:rPr/w:rStyle/@w:val='phone']">
-<!ENTITY fax "w:r[w:rPr/w:rStyle/@w:val='fax']">
-<!ENTITY otheraddr "w:r[w:rPr/w:rStyle/@w:val='otheraddr']">
-<!ENTITY shortaffil "w:r[w:rPr/w:rStyle/@w:val='shortaffil']">
-<!ENTITY jobtitle "w:r[w:rPr/w:rStyle/@w:val='jobtitle']">
-<!ENTITY orgname "w:r[w:rPr/w:rStyle/@w:val='orgname']">
-<!ENTITY orgdiv "w:r[w:rPr/w:rStyle/@w:val='orgdiv']">
-<!ENTITY revnumber "w:r[w:rPr/w:rStyle/@w:val='revnumber']">
-<!ENTITY date "w:r[w:rPr/w:rStyle/@w:val='date']">
-<!ENTITY authorinitials "w:r[w:rPr/w:rStyle/@w:val='authorinitials']">
-<!ENTITY filename "w:r[w:rPr/w:rStyle/@w:val='filename']">
-<!ENTITY sgmltag "w:r[w:rPr/w:rStyle/@w:val='sgmltag']">
-<!ENTITY application "w:r[w:rPr/w:rStyle/@w:val='application']">
-<!ENTITY literal "w:r[w:rPr/w:rStyle/@w:val='literal']">
-<!ENTITY inlinegraphic "w:r[w:rPr/w:rStyle/@w:val='inlinegraphic']">
-]>
-
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- 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"
- exclude-result-prefixes="aml w wx o v">
-
- <!-- $Id$ -->
- <!-- Stylesheet to convert WordProcessingML to DocBook -->
- <!-- This stylesheet processes the output of wordml-sects.xsl -->
-
- <xsl:output indent="yes" method="xml"
- cdata-section-elements='programlisting literallayout'/>
-
- <!-- ================================================== -->
- <!-- 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="element.name">
- <xsl:call-template name='component-name'>
- <xsl:with-param name='node' select='$first.node'/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test='$element.name = "bogus"'>
- <xsl:apply-templates mode='group'/>
- </xsl:when>
- <xsl:when test='$element.name = "bibliography" or
- $element.name = "bibliodiv" or
- $element.name = "glossary" or
- $element.name = "glossdiv" or
- $element.name = "qandaset" or
- $element.name = "qandadiv"'>
- <xsl:element name='{$element.name}'>
- <xsl:call-template name="object.id"/>
- <xsl:call-template name='attributes'>
- <xsl:with-param name='node' select='$first.node'/>
- </xsl:call-template>
-
- <xsl:variable name='entries'
- select='*[1]/following-sibling::w:p[(starts-with($element.name, "biblio") and self::&biblioentrytitle;) or
- (starts-with($element.name, "gloss") and self::&glossterm;) or
- (starts-with($element.name, "qanda") and self::&question;)]'/>
-
- <xsl:variable name='components' select='wx:sub-section | $entries'/>
-
- <xsl:choose>
- <xsl:when test='not($components)'>
- <xsl:message> <xsl:value-of select='$element.name'/> found with no divisions or entries </xsl:message>
- <xsl:comment> <xsl:value-of select='$element.name'/> found with no divisions or entries </xsl:comment>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select='$components[1]/preceding-sibling::*'
- mode='group'/>
- <xsl:apply-templates select='wx:sub-section | $entries'
- mode='component-entries'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:element name="{$element.name}">
- <xsl:call-template name="object.id"/>
- <xsl:call-template name='attributes'>
- <xsl:with-param name='node' select='$first.node'/>
- </xsl:call-template>
- <xsl:apply-templates mode="group"/>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- TODO: generate this template from sections-spec.xml and
- blocks-spec.xml
- -->
- <xsl:template name='component-name'>
- <xsl:param name='node' select='.'/>
- <xsl:variable name="style" select="$node/w:pPr/w:pStyle/@w:val"/>
-
- <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 = 'bibliography' or
- $style = 'bibliography-title'">bibliography</xsl:when>
- <xsl:when test="$style = 'bibliodiv' or
- $style = 'bibliodiv-title'">bibliodiv</xsl:when>
- <xsl:when test="$style = 'book' or
- $style = 'book-title'">book</xsl:when>
- <xsl:when test="$style = 'chapter' or
- $style = 'chapter-title'">chapter</xsl:when>
- <xsl:when test="$style = 'glossary' or
- $style = 'glossary-title'">glossary</xsl:when>
- <xsl:when test="$style = 'glossdiv' or
- $style = 'glossdiv-title'">glossdiv</xsl:when>
- <xsl:when test="$style = 'part' or
- $style = 'part-title'">part</xsl:when>
- <xsl:when test="$style = 'preface' or
- $style = 'preface-title'">preface</xsl:when>
- <xsl:when test="$style = 'qandaset' or
- $style = 'qandaset-title'">qandaset</xsl:when>
- <xsl:when test="$style = 'qandadiv' or
- $style = 'qandadiv-title'">qandadiv</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:template>
-
- <!-- sub-section title paragraph -->
- <xsl:template match="wx:sub-section/w:p[1]" mode="group">
- <xsl:variable name='parent'>
- <xsl:call-template name='component-name'/>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test='$parent != "qandaset" and
- (../&releaseinfo; |
- ../&author; |
- ../&editor; |
- ../&othercredit; |
- ../&revhistory; |
- ../&revision; |
- ../&abstract;)'>
- <xsl:element name='{$parent}info'>
- <title>
- <xsl:apply-templates select="w:r|w:hlink"/>
- </title>
- <xsl:apply-templates select='following-sibling::*[1][self::w:p][w:pPr/w:pStyle/@w:val = concat($parent, "-subtitle")]' mode='subtitle'/>
-
- <xsl:variable name='stop.node'
- select='following-sibling::*[not(self::w:p and (
- w:pPr/w:pStyle/@w:val = concat($parent, "-subtitle") or
- &metadata.element.style;))][1]'/>
- <xsl:choose>
- <xsl:when test='$stop.node'>
- <xsl:apply-templates select='../&metadata.elements;[count(following-sibling::*|$stop.node) = count(following-sibling::*)]'
- mode='metadata'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select='../&metadata.elements;'
- mode='metadata'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <title>
- <xsl:apply-templates select="w:r|w:hlink"/>
- </title>
- <xsl:apply-templates select='following-sibling::*[1][self::w:p][w:pPr/w:pStyle/@w:val = concat($parent, "-subtitle")]' mode='subtitle'/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match='w:p[w:pPr/w:pStyle/@w:val = "book-subtitle" or
- w:pPr/w:pStyle/@w:val = "article-subtitle" or
- w:pPr/w:pStyle/@w:val = "section-subtitle" or
- w:pPr/w:pStyle/@w:val = "sect1-subtitle" or
- w:pPr/w:pStyle/@w:val = "sect2-subtitle" or
- w:pPr/w:pStyle/@w:val = "sect3-subtitle" or
- w:pPr/w:pStyle/@w:val = "sect4-subtitle" or
- w:pPr/w:pStyle/@w:val = "sect5-subtitle" or
- w:pPr/w:pStyle/@w:val = "appendix-subtitle" or
- w:pPr/w:pStyle/@w:val = "bibliography-subtitle" or
- w:pPr/w:pStyle/@w:val = "bibliodiv-subtitle" or
- w:pPr/w:pStyle/@w:val = "biblioentry-subtitle" or
- w:pPr/w:pStyle/@w:val = "chapter-subtitle" or
- w:pPr/w:pStyle/@w:val = "glossary-subtitle" or
- w:pPr/w:pStyle/@w:val = "part-subtitle" or
- w:pPr/w:pStyle/@w:val = "preface-subtitle" or
- w:pPr/w:pStyle/@w:val = "reference-subtitle" or
- w:pPr/w:pStyle/@w:val = "set-subtitle"]' mode='group'>
-
- <xsl:variable name='parent' select='substring-before(w:pPr/w:pStyle/@w:val, "-")'/>
-
- <xsl:if test='preceding-sibling::*[1][not(self::w:p) or
- (self::w:p and w:pPr/w:pStyle/@w:val != concat($parent, "-title"))]'>
- <xsl:call-template name='report-error'>
- <xsl:with-param name='message'>
- <xsl:text>paragraph style "</xsl:text>
- <xsl:value-of select='w:pPr/w:pStyle/@w:val'/>
- <xsl:text>" found without a preceding title</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match='w:p' mode='subtitle'>
- <subtitle>
- <xsl:call-template name='attributes'/>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </subtitle>
- </xsl:template>
- <xsl:template match='*' mode='subtitle'>
- <xsl:call-template name='report-error'>
- <xsl:with-param name='message'>
- <xsl:text>paragraph style "</xsl:text>
- <xsl:value-of select='w:pPr/w:pStyle/@w:val'/>
- <xsl:text>" found in subtitle context</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template match='wx:sub-section' mode='component-entries'>
- <xsl:apply-templates select='.' mode='group'/>
- </xsl:template>
-
- <xsl:template match='&biblioentrytitle;' mode='component-entries'>
- <xsl:variable name='components'
- select='following-sibling::wx:sub-section |
- following-sibling::&biblioentrytitle;'/>
-
- <biblioentry>
- <title>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </title>
-
- <xsl:apply-templates select='following-sibling::*[generate-id(following-sibling::*[self::wx:sub-section | self::&biblioentrytitle;][1]) = generate-id($components[1])]'
- mode='metadata'/>
- </biblioentry>
- </xsl:template>
-
- <xsl:template match='&glossterm;' mode='component-entries'>
- <!-- TODO -->
- </xsl:template>
-
- <xsl:template match='&question;' mode='component-entries'>
- <xsl:variable name='components'
- select='following-sibling::wx:sub-section |
- following-sibling::&question; |
- following-sibling::&answer;'/>
-
- <qandaentry>
- <question>
- <para>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </para>
- <xsl:choose>
- <xsl:when test='$components'>
- <xsl:apply-templates select='following-sibling::*[generate-id(following-sibling::*[self::wx:sub-section | self::&question; | self::&answer;][1]) = generate-id($components[1])]'
- mode='group'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select='following-sibling::*'
- mode='group'/>
- </xsl:otherwise>
- </xsl:choose>
- </question>
- <xsl:if test='$components[1]/self::&answer;'>
- <answer>
- <para>
- <xsl:apply-templates select='$components[1]/*[self::w:r|self::w:hlink]'/>
- </para>
- <xsl:choose>
- <xsl:when test='$components[2]'>
- <xsl:apply-templates select='$components[1]/following-sibling::*[generate-id(following-sibling::*[self::wx:sub-section | self::&question; | self::&answer;][1]) = generate-id($components[2])]'
- mode='group'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select='$components[1]/following-sibling::*'
- mode='group'/>
- </xsl:otherwise>
- </xsl:choose>
- </answer>
- </xsl:if>
- </qandaentry>
- </xsl:template>
-
- <!-- metadata -->
- <xsl:template match="&metadata.elements;|&revremark;" mode='group'/>
- <xsl:template match='&abstracttitle;' mode='metadata'/>
- <xsl:template match='&abstract;' mode='metadata'>
- <xsl:choose>
- <xsl:when test='preceding-sibling::*[1][self::&abstracttitle;]'>
- <abstract>
- <title>
- <xsl:apply-templates
- select='preceding-sibling::*[1]/*[self::w:r|self::w:hlink]'/>
- </title>
- <xsl:apply-templates select='.' mode='abstract'/>
- </abstract>
- </xsl:when>
- <xsl:when test='preceding-sibling::*[1][not(self::&abstract;)]'>
- <abstract>
- <xsl:apply-templates select='.' mode='abstract'/>
- </abstract>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='*' mode='abstract'/>
- <xsl:template match='&abstract;' mode='abstract'>
- <para>
- <xsl:call-template name='object.id'/>
- <xsl:apply-templates select="w:r|w:hlink"/>
- </para>
- <xsl:apply-templates select='following-sibling::*[1]' mode='abstract'/>
- </xsl:template>
- <xsl:template match='&bibliomisc;' mode='metadata'>
- <bibliomisc>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </bibliomisc>
- </xsl:template>
- <xsl:template match='&bibliorelation;' mode='metadata'>
- <bibliorelation>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </bibliorelation>
- </xsl:template>
- <xsl:template match='&publishername;' mode='metadata'>
- <publishername>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </publishername>
- </xsl:template>
- <xsl:template match='&isbn;' mode='metadata'>
- <isbn>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </isbn>
- </xsl:template>
- <xsl:template match="&releaseinfo;" mode='metadata'>
- <releaseinfo>
- <xsl:call-template name='attributes'/>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </releaseinfo>
- </xsl:template>
- <xsl:template match="&author;|&editor;|&othercredit;" mode='metadata'>
- <xsl:element name='{w:pPr/w:pStyle/@w:val}'>
- <xsl:apply-templates select='w:r|w:hlink' mode='metadata'/>
- <xsl:apply-templates select='following-sibling::w:p' mode='author'/>
- </xsl:element>
- </xsl:template>
- <xsl:template match='*' mode='author'/>
- <xsl:template match='&authorblurb;' mode='author'>
- <authorblurb>
- <para>
- <xsl:call-template name='object.id'/>
- <xsl:apply-templates select="w:r|w:hlink"/>
- </para>
- <!-- TODO: continuations -->
- </authorblurb>
- </xsl:template>
- <xsl:template match='&affiliation;' mode='author'>
- <affiliation>
- <xsl:call-template name='object.id'/>
- <xsl:apply-templates select="&shortaffil;|&jobtitle;|&orgname;|&orgdiv;" mode='metadata'/>
- <xsl:if test='&honorific;|&firstname;|&surname;|&lineage;|&othername;|&contrib;|&street;|&pob;|&postcode;|&city;|&state;|&country;|☎|&fax;|&otheraddr;|w:hlink'>
- <address>
- <xsl:apply-templates select="&honorific;|&firstname;|&surname;|&lineage;|&othername;|&contrib;|&street;|&pob;|&postcode;|&city;|&state;|&country;|☎|&fax;|&otheraddr;|w:hlink" mode='metadata'/>
- </address>
- </xsl:if>
- </affiliation>
- </xsl:template>
- <xsl:template match='&continue;' mode='author'>
- <address>
- <xsl:apply-templates select='w:r|w:hlink' mode='metadata'/>
- </address>
- </xsl:template>
- <xsl:template match='&revhistory;|&revremark;' mode='metadata'/>
- <xsl:template match='&revision;' mode='metadata'>
- <xsl:if test='not(preceding-sibling::&revision;)'>
- <revhistory>
- <xsl:apply-templates select='.|following-sibling::&revision;'
- mode='revhistory'/>
- </revhistory>
- </xsl:if>
- </xsl:template>
- <xsl:template match='&revision;' mode='revhistory'>
- <revision>
- <xsl:if test='&revnumber;'>
- <revnumber>
- <xsl:apply-templates select='&revnumber;' mode='textonly'/>
- </revnumber>
- </xsl:if>
- <xsl:if test='&date;'>
- <date>
- <xsl:apply-templates select='&date;' mode='textonly'/>
- </date>
- </xsl:if>
- <xsl:if test='&authorinitials;'>
- <authorinitials>
- <xsl:apply-templates select='&authorinitials;' mode='textonly'/>
- </authorinitials>
- </xsl:if>
- <xsl:apply-templates select='following-sibling::*[1][self::&revremark;]'
- mode='revhistory'/>
- </revision>
- </xsl:template>
- <xsl:template match='&revremark;' mode='revhistory'>
- <revremark>
- <xsl:apply-templates/>
- </revremark>
- </xsl:template>
- <xsl:template match='w:r|w:hlink' mode='metadata' priority='0'>
- <contrib>
- <xsl:apply-templates select='w:t'/>
- </contrib>
- </xsl:template>
- <xsl:template match='&surname;|&firstname;|&honorific;|&lineage;|&othername; |
- &orgname; |
- &contrib; |
- &street;|&pob;|&postcode;|&city;|&state;|&country;|☎|&fax;' mode='metadata'>
- <xsl:element name='{w:rPr/w:rStyle/@w:val}'>
- <xsl:apply-templates select='w:t'/>
- </xsl:element>
- </xsl:template>
- <xsl:template match='&otheraddr;' mode='metadata'>
- <otheraddr>
- <xsl:apply-templates select='w:t'/>
- </otheraddr>
- </xsl:template>
- <xsl:template match='w:hlink' mode='metadata'>
- <xsl:choose>
- <xsl:when test='starts-with(@w:dest, "mailto:")'>
- <email>
- <xsl:apply-templates select='.'/>
- </email>
- </xsl:when>
- <xsl:otherwise>
- <otheraddr>
- <xsl:apply-templates select='.'/>
- </otheraddr>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='&address;' mode='metadata'>
- <address>
- <xsl:apply-templates select='w:r|w:hlink' mode='metadata'/>
- </address>
- </xsl:template>
-
- <xsl:template match='wordlist'
- priority='2'
- mode='group'>
- <xsl:choose>
- <xsl:when test='preceding-sibling::*[1][self::&wordlist;]'>
- <xsl:comment> wordlist subsequent item </xsl:comment>
- </xsl:when>
- <xsl:otherwise>
- <xsl:comment> wordlist first item </xsl:comment>
- </xsl:otherwise>
- </xsl:choose>
- </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">
- <xsl:message>No match found for <xsl:value-of select='w:pPr/w:pStyle/@w:val'/></xsl:message>
- <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'/>
-
- <!-- highlights are grouped together, match on the first occurrence -->
- <xsl:template match='&highlights;[not(preceding-sibling::*[1]
- [self::&highlights; or self::&continue;])]'
- priority='2'
- mode='group'>
- <xsl:variable name='stop.node'
- select='following-sibling::*[not(self::&highlights; or self::&continue;)][1]'/>
-
- <highlights>
- <xsl:choose>
- <xsl:when test='$stop.node'>
- <xsl:apply-templates mode='highlights'
- select='. |
- following-sibling::&highlights;[following-sibling::*[generate-id() = generate-id($stop.node)]] |
- following-sibling::&continue;[following-sibling::*[generate-id() = generate-id($stop.node)]]'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates mode='highlights'
- select='. | following-sibling::*'/>
- </xsl:otherwise>
- </xsl:choose>
- </highlights>
- </xsl:template>
- <xsl:template match='w:p[w:pPr/w:pStyle/@w:val = "highlights"]' mode='highlights'>
- <para>
- <xsl:call-template name='object.id'/>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </para>
- </xsl:template>
- <xsl:template match='&continue;' mode='highlights'>
- <xsl:if test='preceding-sibling::*[1][self::&highlights;]'>
- <para>
- <xsl:call-template name='object.id'/>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </para>
- </xsl:if>
- </xsl:template>
- <xsl:template match='w:p[w:pPr/w:pStyle/@w:val = "highlights-itemizedlist" or
- w:pPr/w:pStyle/@w:val = "highlights-orderedlist"]' mode='highlights'>
- <xsl:if test='not(preceding-sibling::*) or
- preceding-sibling::*[1][not(self::&highlights;)] or
- preceding-sibling::*[1][self::w:p and w:pPr/w:pStyle/@w:val = "highlights"]'>
- <xsl:variable name='stop.node'
- select='following-sibling::*[not(self::w:p) or
- not((self::w:p and w:pPr/w:pStyle/@w:val = current()/w:pPr/w:pStyle/@w:val) or
- self::&continue;)][1]'/>
-
- <itemizedlist>
- <xsl:choose>
- <xsl:when test='$stop.node'>
- <xsl:apply-templates mode='highlights-listitem'
- select='. |
- following-sibling::w:p[w:pPr/w:pStyle/@w:val = current()/w:pPr/w:pStyle/@w:val][following-sibling::*[generate-id() = generate-id($stop.node)]]'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates mode='highlights-listitem'
- select='. |
- following-sibling::w:p[w:pPr/w:pStyle/@w:val = current()/w:pPr/w:pStyle/@w:val]'/>
- </xsl:otherwise>
- </xsl:choose>
- </itemizedlist>
- </xsl:if>
- </xsl:template>
- <xsl:template match='&highlights;' mode='highlights-listitem'>
- <listitem>
- <para>
- <xsl:call-template name='object.id'/>
- <xsl:apply-templates select='w:r|w:hlink'/>
- <xsl:apply-templates mode='item'
- select='following-sibling::*[1][self::&continue;]'/>
- </para>
- </listitem>
- </xsl:template>
- <xsl:template match='&highlights;[preceding-sibling::*[1]
- [self::&highlights; or self::&continue;]]'
- mode='group'>
- <!-- handled in mode = group -->
- </xsl:template>
-
- <!-- Match on the first one of an itemizedlist -->
- <!-- Special case: questions may include a list.
- This will be better handled by the addition of another stylesheet
- stage that marks block-level elements.
- -->
- <xsl:template match="&itemizedlist1;[not(preceding-sibling::*[1]
- [self::&itemizedlist; or
- self::&continue; or
- self::&question;])]"
- priority="2"
- mode="group">
-
- <!-- Identify the node that follows all the listitems -->
- <xsl:variable name="stop.node"
- select="following-sibling::*[not(self::&itemizedlist;
- or self::&continue;
- or self::&orderedlist;)][1]"/>
- <xsl:variable name='stop.node.id' select='generate-id($stop.node)'/>
-
- <!-- Start the list and process all the level 1 listitems -->
- <itemizedlist>
- <xsl:choose>
- <xsl:when test='$stop.node'>
- <xsl:apply-templates
- mode="item"
- select=".|following-sibling::&itemizedlist;[&listlevel; = '' or &listlevel; = '1']
- [following-sibling::*[generate-id() = $stop.node.id]]">
- <xsl:with-param name="depth" select="1"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates
- mode='item'
- select='.|following-sibling::&itemizedlist;[&listlevel; = "" or &listlevel; = "1"]'/>
- </xsl:otherwise>
- </xsl:choose>
- </itemizedlist>
-
- </xsl:template>
-
- <xsl:template match="&itemizedlist;|&itemizedlist1;" 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; or
- self::&question;]]"
- 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>
-
- <xsl:template match="&bridgehead;" mode="group">
- <bridgehead>
- <xsl:call-template name="object.id"/>
- <xsl:call-template name='attributes'/>
- <xsl:apply-templates select="w:r|w:hlink"/>
- </bridgehead>
- </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:u |
- w:r/w:rPr/w:rStyle[@w:val='ulink' or @w:val='Hyperlink']]">
- <ulink url='{@w:dest}'>
- <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[starts-with(w:rPr/w:rStyle/@w:val, "emphasis")]'
- priority='2'>
- <xsl:choose>
- <xsl:when test='ancestor::w:hlink'>
- <xsl:apply-templates select='w:t'/>
- </xsl:when>
- <xsl:when test='w:rPr/w:rStyle/@w:val = "emphasis-bold"'>
- <emphasis role='bold'>
- <xsl:apply-templates select="w:t"/>
- </emphasis>
- </xsl:when>
- <xsl:when test='w:rPr/w:rStyle/@w:val = "emphasis-underline"'>
- <emphasis role='underline'>
- <xsl:apply-templates select="w:t"/>
- </emphasis>
- </xsl:when>
- <xsl:otherwise>
- <emphasis>
- <xsl:apply-templates select="w:t"/>
- </emphasis>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="w:r[w:rPr/w:i|w:rPr/w:b|w:rPr/w:u]">
- <xsl:call-template name='emphasis-nested'>
- <xsl:with-param name='nodes'
- select='w:rPr/w:i|w:rPr/w:b|w:rPr/w:u'/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name='emphasis-nested'>
- <xsl:param name='nodes' select='/..'/>
-
- <xsl:choose>
- <xsl:when test='$nodes[1]/self::w:i'>
- <emphasis>
- <xsl:call-template name='emphasis-nested'>
- <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
- </xsl:call-template>
- </emphasis>
- </xsl:when>
- <xsl:when test='$nodes[1]/self::w:b'>
- <emphasis role='bold'>
- <xsl:call-template name='emphasis-nested'>
- <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
- </xsl:call-template>
- </emphasis>
- </xsl:when>
- <xsl:when test='$nodes[1]/self::w:u'>
- <emphasis role='underline'>
- <xsl:call-template name='emphasis-nested'>
- <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
- </xsl:call-template>
- </emphasis>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="w:t"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match='&filename;|&sgmltag;|&application;|&literal;'>
- <xsl:element name='{w:rPr/w:rStyle/@w:val}'>
- <xsl:apply-templates select='w:t'/>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match='&inlinegraphic;'>
- <inlinegraphic>
- <xsl:attribute name='fileref'>
- <xsl:apply-templates select='w:t'
- mode='textonly'/>
- </xsl:attribute>
- </inlinegraphic>
- </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='w:p[w:pPr/w:pStyle/@w:val = "informalfigure-imagedata"]' mode='group'>
- <!-- Simple form of figure with no captions, titles, etc -->
- <!-- TODO: allow setting of width and height -->
- <informalfigure>
- <xsl:call-template name="object.id"/>
- <mediaobject>
- <imageobject>
- <imagedata>
- <xsl:attribute name='fileref'>
- <xsl:apply-templates select='w:r|w:hlink' mode='textonly'/>
- </xsl:attribute>
- </imagedata>
- </imageobject>
- </mediaobject>
- </informalfigure>
- </xsl:template>
-
- <xsl:template match='&mediaobjecttitle; |
- &mediaobjectcotitle;'
- mode='group'>
- <xsl:element name='{substring-before(w:pPr/w:pStyle/@w:val, "-title")}'>
- <xsl:call-template name="object.id"/>
- <objectinfo>
- <title>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </title>
- </objectinfo>
-
- <xsl:apply-templates select='following-sibling::*[1]'
- mode='mediaobject'/>
- </xsl:element>
- </xsl:template>
-
- <!-- consecutive image(co)object, audioobject, videoobject and
- textobject elements are placed in a mediaobject(co) container.
- -->
- <xsl:template match='&imageobject; |
- &imageobjectco; |
- &audioobject; |
- &videoobject; |
- &textobjecttitle;'
- mode='group'>
- <xsl:choose>
- <xsl:when test='self::&imageobjectco; and
- preceding-sibling::*[1][self::&areaspec; | self::&area;]'>
- <mediaobjectco>
- <xsl:apply-templates select='.' mode='mediaobject'/>
- </mediaobjectco>
- </xsl:when>
- <xsl:when test='preceding-sibling::*[1]
- [self::&mediaobjecttitle; |
- self::&mediaobjectcotitle; |
- self::&imageobject; |
- self::&imageobjectco; |
- self::&audioobject; |
- self::&videoobject; |
- self::&textobjecttitle;]'/>
- <xsl:when test='self::&imageobjectco;'>
- <mediaobjectco>
- <xsl:apply-templates select='.' mode='mediaobject'/>
- <xsl:call-template name='make-calloutlist'/>
- </mediaobjectco>
- </xsl:when>
- <xsl:otherwise>
- <mediaobject>
- <xsl:apply-templates select='.' mode='mediaobject'/>
- </mediaobject>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='&imageobject;' mode='mediaobject'>
- <xsl:element name='{substring-before(w:pPr/w:pStyle/@w:val, "-imagedata")}'>
- <imagedata>
- <xsl:attribute name='fileref'>
- <xsl:apply-templates select='w:r|w:hlink' mode='textonly'/>
- </xsl:attribute>
- </imagedata>
- </xsl:element>
- <xsl:apply-templates select='following-sibling::*[1]'
- mode='mediaobject'/>
- </xsl:template>
- <xsl:template match='&imageobjectco;' mode='mediaobject'>
- <xsl:element name='{substring-before(w:pPr/w:pStyle/@w:val, "-imagedata")}'>
- <xsl:call-template name='make-areaspec'/>
- <imageobject>
- <imagedata>
- <xsl:attribute name='fileref'>
- <xsl:apply-templates select='w:r|w:hlink' mode='textonly'/>
- </xsl:attribute>
- </imagedata>
- </imageobject>
- <xsl:call-template name='make-calloutlist'/>
- </xsl:element>
- <xsl:apply-templates select='following-sibling::*[1]'
- mode='mediaobject'/>
- </xsl:template>
- <xsl:template match='&audioobject;' mode='mediaobject'>
- <audioobject>
- <audiodata>
- <xsl:attribute name='fileref'>
- <xsl:apply-templates select='w:r|w:hlink' mode='textonly'/>
- </xsl:attribute>
- </audiodata>
- </audioobject>
- <xsl:apply-templates select='following-sibling::*[1]'
- mode='mediaobject'/>
- </xsl:template>
- <xsl:template match='&videoobject;' mode='mediaobject'>
- <videoobject>
- <videodata>
- <xsl:attribute name='fileref'>
- <xsl:apply-templates select='w:r|w:hlink' mode='textonly'/>
- </xsl:attribute>
- </videodata>
- </videoobject>
- <xsl:apply-templates select='following-sibling::*[1]'
- mode='mediaobject'/>
- </xsl:template>
- <xsl:template match='&textobjecttitle;' mode='mediaobject'>
- <textobject>
- <objectinfo>
- <title>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </title>
- </objectinfo>
-
- <xsl:apply-templates select='following-sibling::*[1]'
- mode='mediaobject'/>
- </textobject>
- </xsl:template>
- <xsl:template match='&caption;' mode='mediaobject'>
- <caption>
- <para>
- <xsl:apply-templates select='w:r|w:hlink'/>
- </para>
- </caption>
- </xsl:template>
- <xsl:template match='*' mode='mediaobject'/>
-
- <!-- caption is handled in mediaobject mode -->
- <xsl:template match='&caption;' mode='group'/>
-
- <!-- areaspec and area are handled by the imageobjectco -->
- <xsl:template match='&areaspec;|&area;' mode='group'/>
-
- <xsl:template name='make-areaspec'>
- <xsl:variable name='areaspec' select='preceding-sibling::&areaspec;[1]'/>
-
- <xsl:if test='$areaspec'>
- <xsl:variable name='nodes' select='preceding-sibling::*[generate-id(preceding-sibling::&areaspec;[1]) = generate-id($areaspec)]'/>
-
- <xsl:variable name='not.area'
- select='$nodes[not(self::w:p) or self::w:p/w:pPr/w:pStyle/@w:val != "area"]'/>
-
- <xsl:choose>
- <xsl:when test='$not.area'>
- <xsl:message>bad content (<xsl:value-of select='$not.area[1]/w:pPr/w:pStyle/@w:val'/>) in an areaspec</xsl:message>
- <xsl:comment> bad content (<xsl:value-of select='$not.area[1]/w:pPr/w:pStyle/@w:val'/>) in an areaspec </xsl:comment>
- </xsl:when>
- <xsl:otherwise>
- <areaspec>
- <xsl:call-template name='attributes'>
- <xsl:with-param name='node' select='$areaspec'/>
- </xsl:call-template>
- <xsl:apply-templates select='$nodes' mode='area'/>
- </areaspec>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
- <xsl:template match='&area;' mode='area'>
- <area>
- <xsl:call-template name='attributes'/>
- </area>
- </xsl:template>
-
- <!-- calloutlists are handled by the imageobjectco -->
- <xsl:template match='&callout;|&calloutlist;' mode='group'/>
- <xsl:template name='make-calloutlist'>
- <xsl:if test='following-sibling::*[1][self::&callout;]'>
- <xsl:variable
- name='stop.node'
- select='following-sibling::*[not(self::w:p) or
- (self::w:p and not(self::&callout; or
- self::&continue; or
- self::&itemizedlist; or
- self::&orderedlist;))][1]'/>
-
- <calloutlist>
- <xsl:choose>
- <xsl:when test='$stop.node'>
- <xsl:apply-templates select='following-sibling::&callout;[generate-id(following-sibling::*[not(self::w:p) or
- (self::w:p and not(self::&callout; or
- self::&continue; or
- self::&itemizedlist; or
- self::&orderedlist;))][1]) = generate-id($stop.node)]'
- mode='calloutlist'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select='following-sibling::&callout;'
- mode='calloutlist'/>
- </xsl:otherwise>
- </xsl:choose>
- </calloutlist>
- </xsl:if>
- </xsl:template>
- <xsl:template match='&callout;' mode='calloutlist'>
- <callout>
- <xsl:call-template name='attributes'/>
-
- <para>
- <xsl:apply-templates/>
- </para>
-
- <xsl:apply-templates mode='item'
- select='following-sibling::*[1][self::&continue;]'/>
- <!-- Now any nested list inside this callout -->
- <xsl:apply-templates mode='find-subgroup'
- select='following-sibling::*[1][self::&continue;]'>
- <xsl:with-param name='depth' select='2'/>
- </xsl:apply-templates>
- </callout>
- </xsl:template>
-
- <xsl:template match='&continue;' mode='find-subgroup'>
- <xsl:param name='depth' select='0'/>
-
- <xsl:apply-templates mode='find-subgroup'
- select='following-sibling::*[1][self::&continue;]'>
- <xsl:with-param name='depth' select='$depth'/>
- </xsl:apply-templates>
- <xsl:apply-templates mode='subgroup'
- select='following-sibling::*[1]
- [self::&itemizedlist; or self::&orderedlist;]
- [&listlevel; >= $depth]'>
- <xsl:with-param name='depth' select='$depth'/>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match='*' mode='find-subgroup'/>
-
- <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>
-
-<!-- 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">
-
- <!-- Exception: textobjects include the following verbatim element -->
- <xsl:if test='preceding-sibling::*[1][not(self::&textobjecttitle;)]'>
- <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:if>
- </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;|ancestor::&programlistingco;]">
- <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:template match='&programlistingco;
- [not(preceding-sibling::*[1][self::&programlistingco;])]'
- mode='group'>
- <xsl:variable name='stop.node'
- select='following-sibling::*[not(self::&programlistingco;)][1]'/>
-
- <programlistingco>
- <xsl:call-template name='make-areaspec'/>
- <programlisting>
- <xsl:choose>
- <xsl:when test='$stop.node'>
- <xsl:apply-templates
- select='.|following-sibling::&programlistingco;
- [generate-id(following-sibling::*[not(self::&programlistingco;)][1]) = generate-id($stop.node)]'
- mode='programlistingco'/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select='.|following-sibling::&programlistingco;'
- mode='programlistingco'/>
- </xsl:otherwise>
- </xsl:choose>
- </programlisting>
- <xsl:call-template name='make-calloutlist'/>
- </programlistingco>
- </xsl:template>
- <!-- Handled by first programlistingco -->
- <xsl:template match='&programlistingco;
- [preceding-sibling::*[1][self::&programlistingco;]]'
- mode='group'/>
- <xsl:template match='&programlistingco;' mode='programlistingco'>
- <xsl:apply-templates select='w:r|w:hlink'/>
- <xsl:text>
</xsl:text>
- </xsl:template>
-
- <xsl:template match="&xinclude;"
- xmlns:xi='http://www.w3.org/2001/XInclude'>
- <xi:include>
- <xsl:attribute name='href'>
- <xsl:apply-templates select='w:r|w:hlink' mode='textonly'/>
- </xsl:attribute>
- </xi:include>
- </xsl:template>
-
- <xsl:template name='attributes'>
- <xsl:param name='node' select='.'/>
-
- <xsl:variable name='attr'
- select='$node/w:r[w:rPr/w:rStyle/@w:val = "attributes"]'/>
- <xsl:variable name='annotation' select='$attr/preceding-sibling::aml:annotation[1]'/>
-
- <xsl:if test='$attr and $annotation'>
- <xsl:variable name='comment' select='$node/w:r[w:rPr/w:rStyle/@w:val = "CommentReference"]/aml:annotation[@w:type = "Word.Comment" and @aml:id = $annotation/@aml:id]/aml:content'/>
- <xsl:for-each select='$comment/w:p/w:r[w:rPr/w:rStyle/@w:val = "attribute-name"]'>
- <xsl:attribute name='{w:t}'>
- <xsl:value-of select='following-sibling::w:r[w:rPr/w:rStyle/@w:val = "attribute-value"][1]/w:t'/>
- </xsl:attribute>
- </xsl:for-each>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match='aml:annotation' mode='group'>
- <xsl:choose>
- <xsl:when test='@w:type = "Word.Deletion"'>
- <emphasis role='deletion'>
- <xsl:comment> encode author and mod date here </xsl:comment>
- <xsl:apply-templates mode='revision'/>
- </emphasis>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template match='aml:annotation'/>
- <xsl:template match='w:r[w:rPr/w:rStyle/@w:val = "attributes"]'/>
- <xsl:template match='w:r[w:rPr/w:rStyle/@w:val = "CommentReference"]'/>
-
- <!-- utilities -->
-
- <!-- This template is invoked whenever an error condition is detected in the conversion of a WordML document.
- -->
- <xsl:template name='report-error'>
- <xsl:param name='node' select='.'/>
- <xsl:param name='message'/>
-
- <xsl:message><xsl:value-of select='$message'/></xsl:message>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<xsl:stylesheet version="1.0"
- xmlns:xsl="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">
-
- <xsl:output method='xml' indent="yes" encoding='UTF-8'/>
-
- <!-- ********************************************************************
- $Id$
- ********************************************************************
-
- This file is part of the XSL DocBook Stylesheet distribution.
- See ../README or http://docbook.sf.net/release/xsl/current/ for
- copyright and other information.
-
- ******************************************************************** -->
-
- <xsl:strip-space elements='*'/>
- <xsl:preserve-space elements='w:t'/>
-
- <xsl:template match="w:wordDocument">
- <xsl:copy>
- <xsl:apply-templates select='w:body'/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match='wx:sect|wx:sub-section|wx:pBdrGroup'>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match='wx:borders |
- wx:margin-left'/>
-
- <xsl:template match='w:pStyle|w:rStyle'>
- <xsl:copy>
- <xsl:for-each select='@*'>
- <xsl:copy/>
- </xsl:for-each>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match='*'>
- <xsl:copy>
- <xsl:for-each select='@*'>
- <xsl:copy/>
- </xsl:for-each>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
-
-</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">
-<!--====================================-->
-<!--= =-->
-<!--= This stylesheet is generated =-->
-<!--= by makeSections.xsl and a =-->
-<!--= mapping specification. =-->
-<!--= =-->
-<!--= IF YOU EDIT THIS STYLESHEET =-->
-<!--= YOUR CHANGES WILL GET =-->
-<!--= OVERWRITTEN!! =-->
-<!--= =-->
-<!--= Revision history: =-->
-<!--= 1.2 2005-10-03 SRB =-->
-<!--= Change XML Namespace URI. =-->
-<!--= 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: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: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 = "part" or w:pPr/w:pStyle/@w:val = "part-title" or 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 = "part" or w:pPr/w:pStyle/@w:val = "part-title" or 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="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 = "part" or w:pPr/w:pStyle/@w:val = "part-title" or 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 = "part" or w:pPr/w:pStyle/@w:val = "part-title" or 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="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="*">
- <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 name="copy">
- <axsl:copy>
- <axsl:for-each select="@*">
- <axsl:copy/>
- </axsl:for-each>
- <axsl:apply-templates/>
- </axsl:copy>
- </axsl:template>
-</axsl:stylesheet>
+++ /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 -->
-
-<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') 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">
- <xsl:variable name="style" select="w:pPr/w:pStyle/@w:val"/>
- <xsl:variable name="element.name">
- <xsl:choose>
- <xsl:when test="$style = 'article'">title</xsl:when>
- <xsl:when test="$style = 'sect1'">title</xsl:when>
- <xsl:when test="$style = 'sect2'">title</xsl:when>
- <xsl:when test="$style = 'sect3'">title</xsl:when>
- <xsl:when test="$style = 'sect4'">title</xsl:when>
- <xsl:when test="$style = 'sect5'">title</xsl:when>
- <xsl:when test="$style = 'appendix'">title</xsl:when>
- <xsl:otherwise>title</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$element.name}">
- <xsl:apply-templates select="w:r|w:hlink"/>
- </xsl:element>
-</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:comment> style "<xsl:value-of select='w:pPr/w:pStyle/@w:val'/>" </xsl:comment>
- <xsl:apply-templates select="w:r|w:hlink"/>
- </nomatch>
- </xsl:template>
-
-<!-- unused elements are bypassed -->
-<xsl:template match="*" mode="group">
-</xsl:template>
-
-<!-- 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='w:p[w:pPr/w:pStyle/@w:val = "informalfigure-imagedata"]' mode='group'>
- <!-- Simple form of figure with no captions, titles, etc -->
- <!-- TODO: allow setting of width and height -->
- <informalfigure>
- <xsl:call-template name="object.id"/>
- <mediaobject>
- <imageobject>
- <imagedata fileref='{w:r|w:hlink}'/>
- </imageobject>
- </mediaobject>
- </informalfigure>
- </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>