<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes">
<xsl:import href="../../Tools/docbook-xsl-1.74.3/html/docbook.xsl"/>
<xsl:param name="html.stylesheet" select="'AddStyle.css'"/>
<xsl:param name="admon.graphics" select="1"/>
<xsl:param name="generate.legalnotice.link" select="1"/>
<xsl:param name="chapter.autolabel" select="1"/>
<xsl:param name="section.autolabel" select="1"/>
<xsl:param name="draft.mode" select="'no'"/>
<xsl:param name="section.autolabel.max.depth" select="100"/>
<!--chapter toc TO chapter nop (for frameset), For List of Tables Add to book: figure,table,example,equation,procedure-->
<xsl:param name="generate.toc">
appendix nop
article toc,title
book toc,title
chapter nop
part title
preface title
qandadiv nop
qandaset nop
reference toc,title
section toc,title
set toc
</xsl:param>
<xsl:param name="generate.section.toc.level" select="0"/>
<xsl:param name="toc.list.type">ul</xsl:param>
<xsl:param name="toc.section.depth" select="5"/>
<!--<xsl:param name="ulink.target" select="'_blank'"></xsl:param>-->
<xsl:param name="chunk.tocs.and.lots" select="1"/>
<!--seperate chunk for figures and tables-->
<xsl:param name="chunk.separate.lots" select="1"/>
<!--This parameter sets the depth of section chunking.-->
<xsl:param name="chunk.section.depth" select="2"></xsl:param>
<xsl:param name="chunk.first.sections" select="1"/>
<!--add chapter to section numbers(ids)-->
<xsl:param name="section.label.includes.component.label" select="1"/>
<xsl:param name="component.label.includes.part.label" select="1"/>
<xsl:param name="use.id.as.filename" select="'1'"/>
<!-- book toc,title,figure,table,example,equation-->
<xsl:include href="../Publish/HTMLTitlePage_External.xsl"/>
<!-- ==================================================================== -->
<!-- Removes detailed version of TOC from Main Page (Comment out if using frameset for TOC)
<xsl:template match="preface|chapter|appendix|article" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:choose>
<xsl:when test="local-name($toc-context) = 'book'">
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="foo"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="section|sect1|glossary|bibliography|index
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>-->
<!-- ==================================================================== -->
<!--If role="'newwindow'" then ulink opens in newwindow, else opens in the same window-->
<xsl:template match="ulink" name="ulink">
<xsl:variable name="link">
<a>
<xsl:if test="@id">
<xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
</xsl:if>
<xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
<!-- Begin Change by MW -->
<xsl:if test="@role = 'newwindow'">
<xsl:attribute name="target"><xsl:text>_blank</xsl:text></xsl:attribute>
</xsl:if>
<!-- End Change -->
<xsl:choose>
<xsl:when test="count(child::node())=0">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:variable>
<xsl:copy-of select="$link"/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="preface">
<xsl:call-template name="preface.titlepage"/>
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<!--Creating Glossary TOC-->
<xsl:param name="glossterm.auto.link" select="1"/>
<xsl:template match="glossary">
<xsl:call-template name="toc"/>
<div class="{name(.)}">
<xsl:if test="$generate.id.attributes != 0">
<xsl:attribute name="id"><xsl:call-template name="object.id"/></xsl:attribute>
</xsl:if>
<xsl:call-template name="glossary.titlepage"/>
<xsl:choose>
<xsl:when test="glossdiv">
<xsl:apply-templates select="(glossdiv[1]/preceding-sibling::*)"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="glossdiv">
<xsl:apply-templates select="glossdiv"/>
</xsl:when>
<xsl:otherwise>
<dl>
<xsl:apply-templates select="glossentry"/>
</dl>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</div>
</xsl:template>
<!-- ==================================================================== -->
<!-- Create Glossary (Type Dictionary) TOC template-->
<xsl:variable name="uc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lc" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:key name="acr" match="glossentry/glossterm" use="translate(substring(.,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
<xsl:template name="toc">
<h3>Table of Contents</h3>
<xsl:for-each select="glossdiv">
<ul>
<p>
<xsl:for-each select="glossentry[count(glossterm | key('acr',
translate (substring(glossterm,1,1),
'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@',
'abcdefghijklmnopqrstuvwxyz###########'))[1]) = 1]">
<!--<li>-->
<xsl:variable name="id">
<xsl:choose>
<xsl:when test="@id">
<xsl:value-of select="@id"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="#{$id}">
<xsl:value-of select="substring(glossterm,1,1)"/>
</a>
<xsl:if test="not(position()=last())">
<xsl:text> | </xsl:text>
</xsl:if>
<!-- </li>-->
</xsl:for-each>
</p>
</ul>
</xsl:for-each>
</xsl:template>
<!-- ==================================================================== -->
<!-- Changing the style of procedure-->
<!--StepAlternatives template (style change)-->
<xsl:template match="procedure">
<xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement),
concat(local-name(.), ' '))"/>
<xsl:variable name="placement">
<xsl:choose>
<xsl:when test="contains($param.placement, ' ')">
<xsl:value-of select="substring-before($param.placement, ' ')"/>
</xsl:when>
<xsl:when test="$param.placement = ''">before</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.placement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Preserve order of PIs and comments -->
<xsl:variable name="preamble" select="*[not(self::step
or self::title
or self::titleabbrev)]
|comment()[not(preceding-sibling::step)]
|processing-instruction()[not(preceding-sibling::step)]"/>
<div class="{name(.)}">
<xsl:call-template name="anchor">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="title">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:if test="title and $placement = 'before'">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
<xsl:apply-templates select="$preamble"/>
<xsl:choose>
<xsl:when test="count(step) = 1">
<ol>
<xsl:attribute name="type"><xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/></xsl:attribute>
<xsl:apply-templates select="step
|comment()[preceding-sibling::step]
|processing-instruction()[preceding-sibling::step]"/>
</ol>
</xsl:when>
<xsl:otherwise>
<ol>
<xsl:attribute name="type"><xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/></xsl:attribute>
<xsl:apply-templates select="step
|comment()[preceding-sibling::step]
|processing-instruction()[preceding-sibling::step]"/>
</ol>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="title and $placement != 'before'">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
</div>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="procedure/title">
<!-- nop -->
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="substeps">
<xsl:variable name="numeration">
<xsl:call-template name="procedure.step.numeration"/>
</xsl:variable>
<xsl:call-template name="anchor"/>
<ol type="{$numeration}">
<xsl:apply-templates/>
</ol>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="step">
<li>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</li>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="stepalternatives">
<xsl:call-template name="anchor"/>
<xsl:call-template name="getAlt">
<xsl:with-param name="data" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template name="getAlt">
<xsl:param name="data"/>
<xsl:for-each select="$data/step">
<p style="margin-left: 12px;">
<font style="font-style:italic;">Alternative: </font>
<xsl:apply-templates/>
<br/>
</p>
</xsl:for-each>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="step/*[1][local-name()='para' or
local-name()='simpara' or
local-name()='formalpara']" priority="2">
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="step/title">
<p class="title">
<b>
<xsl:apply-templates/>
</b>
</p>
</xsl:template>
<!--============================================-->
<xsl:template match="*[@role='notintoc']" mode="toc" priority="2"/>
<xsl:template match="itemizedlist/listitem">
<xsl:variable name="mark" select="../@mark"/>
<xsl:variable name="override" select="@override"/>
<xsl:variable name="class" select="@class"/>
<xsl:variable name="usemark">
<xsl:choose>
<xsl:when test="$override != ''">
<xsl:value-of select="$override"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$mark"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="cssmark">
<xsl:choose>
<xsl:when test="$usemark = 'opencircle'">circle</xsl:when>
<xsl:when test="$usemark = 'bullet'">disc</xsl:when>
<xsl:when test="$usemark = 'box'">square</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$usemark"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<li>
<xsl:if test="$css.decoration = '1' and $cssmark != ''">
<xsl:attribute name="style">
<xsl:text>list-style-type: </xsl:text>
<xsl:value-of select="$cssmark"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">
<xsl:value-of select="$class"/>
</xsl:attribute>
<!-- we can't just drop the anchor in since some browsers (Opera)
get confused about line breaks if we do. So if the first child
is a para, assume the para will put in the anchor. Otherwise,
put the anchor in anyway. -->
<xsl:if test="local-name(child::*[1]) != 'para'">
<xsl:call-template name="anchor"/>
</xsl:if>
<xsl:choose>
<xsl:when test="$show.revisionflag != 0 and @revisionflag">
<div class="{@revisionflag}">
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:template>
<!--Test Hover text-->
<!-- ==================================================================== -->
<!--
<xsl:template match="link" name="link">
<xsl:param name="a.target"/>
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="@linkend"/>
</xsl:call-template>
<a>
<xsl:if test="@id">
<xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:if test="@id='HoverDesc'">
<xsl:attribute name="class">
<xsl:value-of select="'change'"/>
</xsl:attribute>-->
<!--comment start <xsl:attribute name="onMouseover">
<xsl:variable name="testVar">
alert('<xsl:value-of select="@desc"/>')
</xsl:variable>
<xsl:value-of select="$testVar"/></xsl:attribute>
<xsl:element name="span">
<xsl:value-of select="@desc"/>
</xsl:element> comment end-->
<!-- </xsl:if>
</xsl:if>
<xsl:if test="$a.target">
<xsl:attribute name="target"><xsl:value-of select="$a.target"/></xsl:attribute>
</xsl:if>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>-->
<!-- FIXME: is there a better way to tell what elements have a title? -->
<!-- <xsl:if test="local-name($target) = 'book'
or local-name($target) = 'set'
or local-name($target) = 'chapter'
or local-name($target) = 'preface'
or local-name($target) = 'appendix'
or local-name($target) = 'bibliography'
or local-name($target) = 'glossary'
or local-name($target) = 'index'
or local-name($target) = 'part'
or local-name($target) = 'refentry'
or local-name($target) = 'reference'
or local-name($target) = 'example'
or local-name($target) = 'equation'
or local-name($target) = 'table'
or local-name($target) = 'figure'
or local-name($target) = 'simplesect'
or starts-with(local-name($target),'sect')
or starts-with(local-name($target),'refsect')">
<xsl:attribute name="title">
<xsl:apply-templates select="$target"
mode="object.title.markup.textonly"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="count(child::node()) > 0">-->
<!-- If it has content, use it -->
<!-- <xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>-->
<!-- else look for an endterm -->
<!-- <xsl:choose>
<xsl:when test="@endterm">
<xsl:variable name="etargets" select="key('id',@endterm)"/>
<xsl:variable name="etarget" select="$etargets[1]"/>
<xsl:choose>
<xsl:when test="count($etarget) = 0">
<xsl:message>
<xsl:value-of select="count($etargets)"/>
<xsl:text>Endterm points to nonexistent ID: </xsl:text>
<xsl:value-of select="@endterm"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$etarget" mode="endterm"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Link element has no content and no Endterm. </xsl:text>
<xsl:text>Nothing to show in the link to </xsl:text>
<xsl:value-of select="$target"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@id='HoverDesc'">
<xsl:element name="span">
<xsl:value-of select="@desc"/>
</xsl:element>
</xsl:if>
</a>
</xsl:template> -->
<xsl:template match="hr">
<hr></hr>
</xsl:template>
</xsl:stylesheet>