home *** CD-ROM | disk | FTP | other *** search
Text File | 2002-09-24 | 27.0 KB | 1,055 lines |
- <!-- XSLT for converting from gcapaper format to HTML + CSS
- Written by Philip Mansfield
- 10 November 2001 - Created to handle gcapaper 6.0 (for XML 2001 Conference)
- 25 February 2002 - Modified to also handle gcapaper 6.1 (for XML Europe 2002)
- (c) 2001-2 Schema Software Inc.
- You may use, reproduce, modify or redistribute this software under
- the condition that you do not sell it and you include this copyright
- notice in all copies. For more information, visit
- http://www.schemasoft.com or write to info@schemasoft.com -->
- <!-- Slightly modified by Lauren Wood, SoftQuad.
- As per instructions, keywords should not be rendered.
- Included Schemasoft's CSS styling for the HTML in the XSLT -->
-
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
- doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes"/>
-
- <xsl:template match="gcapaper">
- <html>
- <xsl:apply-templates/>
- <xsl:text disable-output-escaping="yes"></body></xsl:text>
- </html>
- </xsl:template>
-
- <!-- Front matter -->
- <xsl:template match="front">
- <head>
- <xsl:apply-templates select="title|keyword[1]|author" mode="head"/>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
- <meta http-equiv="Content-Style-Type" content="text/css"/>
- <style type="text/css">
- /* Stylesheet for gca2html output */
- /* Produced by Schemasoft (www.schemasoft.com) to go with their XSLT */
- body {
- background-color: white;
- color: black;
- font-family: Times, serif;
- margin-left: 2em;
- margin-top: 2em
- }
- h1, h2, h3, h4, h5, caption {
- font-family: Arial, Helvetica, sans-serif;
- color: green
- }
- h1 {
- text-align: center;
- font-size: 1.6em;
- font-weight: bold;
- margin-top: 2em;
- margin-bottom: 2em
- }
- h2 {
- font-size: 1.3em;
- margin-top: 4em;
- padding: 2px;
- color: white;
- background-color: green
- }
- h2.subt {
- text-align: center;
- margin-top: -1.8em;
- margin-bottom: 2em;
- padding: 0px;
- color: green;
- background-color: white;
- font-family: Times, serif
- }
- h2.abstractHeader, h2.tocHeader {
- text-align: center;
- color: green;
- background-color: white;
- margin-top: 0em;
- margin-bottom: 0em
- }
- h3 {
- font-size: 1.2em;
- margin-top: 2em
- }
- h4 {
- font-size: 1.1em;
- margin-top: 2em
- }
- h5 {
- font-size: 1em;
- margin-top: 1em;
- margin-bottom: 0em;
- background-color: #EEEEEE
- }
- dl { margin-top: 2em }
- dt {
- margin-top: 0.4em;
- font-family: Arial, Helvetica, sans-serif;
- font-weight: bold;
- font-size: 0.95em
- }
- dt.bib {
- color: red;
- font-size: 1em
- }
- dd { margin-top: 0.2em }
- dt.termHeading, dd.defHeading { color: red }
- code { font-family: monospace }
- pre {
- margin-top: 0.5em;
- margin-bottom: 0.5em;
- font-family: monospace
- }
- ul li, p { line-height: 1.3em }
- .authorName {
- font-family: Arial, Helvetica, sans-serif;
- font-weight: bold
- }
- p.keyword {
- color: #000099;
- background-color: #DDDDDD
- }
- p.sectKeyword { color: #000099 }
- p.author { margin-top: 1.5em}
- p.toc {
- margin-left: 2em;
- line-height: 1.5em
- }
- p.abstract {
- margin-left: 2em;
- margin-right: 2em
- }
- p.figcaptionPara {
- font-size: 0.8em;
- text-align: justify
- }
- ul.simple { list-style-type: none }
- ul.bulleted { list-style-type: disc }
- ul.dashed { list-style-type: square }
- ol.arabic { list-style-type: decimal }
- ol.ualpha { list-style-type: upper-alpha }
- ol.uroman { list-style-type: upper-roman }
- ol.lalpha { list-style-type: lower-alpha }
- ol.lroman { list-style-type: lower-roman }
- ol.ftnote {
- list-style-type: decimal;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 0.8em
- }
- blockquote {
- margin-left: 2em;
- margin-right: 2em;
- background-color: white;
- color: black;
- font-family: Times, serif;
- font-style: normal;
- font-weight: normal;
- font-variant: normal;
- font-size: 1em
- }
- blockquote.lquote {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 0.8em
- }
- blockquote.figcaption, blockquote.figurePara, blockquote.figureCodeBlock, blockquote.figureTitle {
- margin-left: 4em;
- margin-right: 4em
- }
- blockquote.tableHeader {
- margin-top: 1em;
- margin-left: 4em;
- margin-right: 4em;
- margin-bottom: 2em
- }
- .figure {
- margin-top: 2em;
- margin-bottom: 2em
- }
- table.note {
- width: 98%;
- border: 1px solid #000099;
- color: #000099
- }
- table.note td { padding: 0.75em }
- .noteHeader {
- font-family: Arial, Helvetica, sans-serif;
- font-weight: bold
- }
- table.codeBlock {
- width: 98%;
- color: green;
- background-color: #EEEEEE
- }
- table.table {
- color: #000099;
- margin-top: 2em;
- empty-cells: show
- }
- table.table caption {
- caption-side: top;
- margin-left: 4em;
- margin-right: 4em;
- text-align: justify;
- font-size: 0.95em
- }
- table.table th {
- font-size: 1em;
- font-weight: bold;
- background-color: #000099;
- color: white;
- padding: 0.5em
- }
- table.table td { padding: 0.5em }
- hr { color: #000099 }
- hr.upperBorder {
- margin-top: 2em;
- margin-bottom: 0em
- }
- hr.lowerBorder {
- margin-top: 0em;
- margin-bottom: 0em
- }
- cite { color: green }
- :link {
- background: none transparent scroll repeat 0% 0%;
- color: #000099
- }
- :visited {
- background: none transparent scroll repeat 0% 0%;
- color: purple
- }
- :active {
- background: none transparent scroll repeat 0% 0%;
- color: red
- }
- @media Screen {
- a:hover { background-color: #FFFFCC }
- }
- a.bibref {
- font-family: Arial, Helvetica, sans-serif
- }
- acronym a:link {
- color: black;
- text-decoration: none
- }
- acronym a:visited {
- color: black;
- text-decoration: none
- }
- acronym a:active {
- color: black;
- text-decoration: none
- }
- acronym a:hover {
- color: black;
- background-color: #FFFFCC;
- text-decoration: none
- }
- </style>
- </head>
- <xsl:text disable-output-escaping="yes"><body></xsl:text>
- <xsl:apply-templates select="keyword[1]|*[not(self::keyword)]"/>
- </xsl:template>
-
- <xsl:template match="title" mode="head">
- <title><xsl:value-of select=".//text()"/></title>
- </xsl:template>
-
- <xsl:template match="keyword[1]" mode="head">
- <meta name="keywords">
- <xsl:attribute name="content">
- <xsl:apply-templates/>
- <xsl:apply-templates select="following-sibling::keyword"/>
- </xsl:attribute>
- </meta>
- </xsl:template>
-
- <xsl:template match="front/keyword[1]">
- <p class="keyword">
- <i class="keywordHeader"><xsl:text>Keywords: </xsl:text></i>
- <xsl:apply-templates/>
- <xsl:apply-templates select="following-sibling::keyword"/>
- </p>
- </xsl:template>
-
- <xsl:template match="front/keyword[position()>1]">
- <xsl:text>, </xsl:text>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="author" mode="head">
- <meta name="author">
- <xsl:attribute name="content">
- <xsl:apply-templates select="fname|surname|suffix"/>
- </xsl:attribute>
- </meta>
- </xsl:template>
-
- <xsl:template match="surname">
- <xsl:text> </xsl:text>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="suffix">
- <xsl:text>, </xsl:text>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="title">
- <h1 class="title"><xsl:apply-templates/></h1>
- </xsl:template>
-
- <xsl:template match="subt">
- <h2 class="subt"><xsl:apply-templates/></h2>
- </xsl:template>
-
- <xsl:template match="author">
- <p class="author">
- <span class="authorName"><xsl:apply-templates select="fname|surname|suffix"/></span>
- <xsl:apply-templates select="jobtitle|address"/>
- </p>
- <xsl:apply-templates select="bio"/>
- </xsl:template>
-
- <xsl:template match="jobtitle">
- <br/><xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="address/*">
- <br/><xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="address/email">
- <br/>
- <a class="email" href="mailto:{text()}">
- <xsl:apply-templates/>
- </a>
- </xsl:template>
-
- <xsl:template match="address/web">
- <br/>
- <a class="web" href="{text()}">
- <xsl:apply-templates/>
- </a>
- </xsl:template>
-
- <xsl:template match="bio">
- <p class="bioHeader"><i>Biography</i></p>
- <blockquote class="bio">
- <xsl:apply-templates/>
- </blockquote>
- </xsl:template>
-
- <xsl:template match="abstract">
- <hr class="upperBorder"/>
- <h2 class="abstractHeader">Abstract</h2>
- <hr class="lowerBorder"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- Body -->
- <xsl:template match="body">
- <hr class="upperBorder"/>
- <h2 class="tocHeader">Table of Contents</h2>
- <hr class="lowerBorder"/>
- <p class="toc">
- <xsl:apply-templates select=".//title" mode="toc"/>
- <xsl:apply-templates select="/descendant::ftnote[position()=1]" mode="toc"/>
- <xsl:apply-templates select="..//acknowl|..//bibliog" mode="toc"/>
- </p>
- <xsl:apply-templates/>
- <xsl:apply-templates select="/descendant::ftnote[position()=1]" mode="footerStart"/>
- </xsl:template>
-
- <!-- Rear matter -->
- <xsl:template match="acknowl">
- <h2 class="acknowlHeader">
- <a name="S.Acknowledgements">Acknowledgements</a>
- </h2>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="acknowl/title">
- <h3 class="acknowlTitle">
- <xsl:apply-templates/>
- </h3>
- </xsl:template>
-
- <xsl:template match="bibliog">
- <h2 class="bibliogHeader">
- <a name="S.Bibliography">Bibliography</a>
- </h2>
- <dl class="bibliog">
- <xsl:apply-templates/>
- </dl>
- </xsl:template>
-
- <xsl:template match="bib">
- <dt class="bib">
- <xsl:apply-templates select="../@id"/>
- <b>[<xsl:apply-templates/>]</b>
- </dt>
- </xsl:template>
-
- <xsl:template match="@id">
- <a name="{.}"/>
- </xsl:template>
-
- <xsl:template match="pub">
- <dd class="pub">
- <xsl:apply-templates/>
- </dd>
- </xsl:template>
-
- <xsl:template match="bibref">
- <a href="#{@refloc}" class="bibref">
- <b>[<xsl:value-of select="id(@refloc)/bib/text()"/>]</b>
- </a>
- <xsl:text> </xsl:text>
- </xsl:template>
-
- <!-- Elements that get copied -->
- <xsl:template match="b|big|code|i|small|sub|sup|tt">
- <xsl:copy>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
-
- <!-- Paragraphs -->
- <xsl:template match="para">
- <p>
- <xsl:apply-templates/>
- </p>
- </xsl:template>
-
- <xsl:template match="abstract/para">
- <p class="abstract">
- <xsl:apply-templates/>
- </p>
- </xsl:template>
-
- <xsl:template match="acknowl/para">
- <p class="acknowl">
- <xsl:apply-templates/>
- </p>
- </xsl:template>
-
- <xsl:template match="li/para">
- <li>
- <xsl:apply-templates/>
- </li>
- </xsl:template>
-
- <!-- Citations -->
- <xsl:template match="cit">
- <cite>
- <xsl:apply-templates/>
- </cite>
- </xsl:template>
-
- <!-- Quotes -->
- <xsl:template match="lquote">
- <blockquote class="lquote">
- <xsl:apply-templates/>
- </blockquote>
- </xsl:template>
-
- <!-- Acronyms -->
- <xsl:template match="acronym">
- <acronym>
- <a>
- <xsl:apply-templates select="@refid"/>
- <xsl:apply-templates/>
- </a>
- </acronym>
- </xsl:template>
-
- <xsl:template match="acronym/@refid">
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text>
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:template>
-
- <xsl:template match="acronym.grp/expansion">
- <xsl:apply-templates select="@id"/>
- <xsl:text> (</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>) </xsl:text>
- </xsl:template>
-
- <!-- Lists -->
- <xsl:template match="randlist">
- <ul>
- <xsl:apply-templates select="@style"/>
- <xsl:apply-templates/>
- </ul>
- </xsl:template>
-
- <xsl:template match="randlist/@style"/>
-
- <xsl:template match="randlist/@style[.='simple']">
- <xsl:attribute name="class">simple</xsl:attribute>
- <xsl:attribute name="type">circle</xsl:attribute>
- </xsl:template>
-
- <xsl:template match="randlist/@style[.='bulleted']">
- <xsl:attribute name="class">bulleted</xsl:attribute>
- <xsl:attribute name="type">disc</xsl:attribute>
- </xsl:template>
-
- <xsl:template match="randlist/@style[.='dashed']">
- <xsl:attribute name="class">dashed</xsl:attribute>
- <xsl:attribute name="type">square</xsl:attribute>
- </xsl:template>
-
- <xsl:template match="seqlist">
- <ol>
- <xsl:apply-templates select="@number"/>
- <xsl:apply-templates/>
- </ol>
- </xsl:template>
-
- <xsl:template match="seqlist/@number"/>
-
- <xsl:template match="seqlist/@number[.='arabic']">
- <xsl:attribute name="class">arabic</xsl:attribute>
- <xsl:attribute name="type">1</xsl:attribute>
- </xsl:template>
-
- <xsl:template match="seqlist/@number[.='ualpha']">
- <xsl:attribute name="class">ualpha</xsl:attribute>
- <xsl:attribute name="type">A</xsl:attribute>
- </xsl:template>
-
- <xsl:template match="seqlist/@number[.='uroman']">
- <xsl:attribute name="class">uroman</xsl:attribute>
- <xsl:attribute name="type">I</xsl:attribute>
- </xsl:template>
-
- <xsl:template match="seqlist/@number[.='lalpha']">
- <xsl:attribute name="class">lalpha</xsl:attribute>
- <xsl:attribute name="type">a</xsl:attribute>
- </xsl:template>
-
- <xsl:template match="seqlist/@number[.='lroman']">
- <xsl:attribute name="class">lroman</xsl:attribute>
- <xsl:attribute name="type">i</xsl:attribute>
- </xsl:template>
-
- <xsl:template match="deflist">
- <xsl:apply-templates select="title"/>
- <dl>
- <xsl:apply-templates select="*[not(self::title)]"/>
- </dl>
- </xsl:template>
-
- <xsl:template match="deflist/title">
- <h5 class="deflistTitle">
- <xsl:apply-templates/>
- </h5>
- </xsl:template>
-
- <xsl:template match="term.heading">
- <dt class="termHeading"><i>
- <xsl:apply-templates/>
- </i></dt>
- </xsl:template>
-
- <xsl:template match="def.heading">
- <dd class="defHeading"><i>
- <xsl:apply-templates/>
- </i></dd>
- </xsl:template>
-
- <xsl:template match="def.term">
- <dt>
- <xsl:apply-templates/>
- </dt>
- </xsl:template>
-
- <xsl:template match="def/para">
- <dd>
- <xsl:apply-templates/>
- </dd>
- </xsl:template>
-
- <!-- Code blocks -->
- <xsl:template match="code.block">
- <table class="codeBlock">
- <tr><td><pre>
- <xsl:apply-templates/>
- </pre></td></tr>
- </table>
- </xsl:template>
-
- <!-- Notes -->
- <xsl:template match="note">
- <table class="note">
- <tr>
- <td>
- <p>
- <span class="noteHeader">
- <xsl:text>NOTE: </xsl:text>
- </span>
- <xsl:apply-templates select="para[1]/node()"/>
- </p>
- <xsl:apply-templates select="para[position()>1]"/>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <!-- Hyperlinks -->
- <xsl:template match="a">
- <a href="{@href}">
- <xsl:value-of select="@href"/>
- </a>
- </xsl:template>
-
- <!-- Footnotes -->
- <xsl:template match="fnref">
- <a href="#{@refloc}" class="fnref"><b>
- <xsl:apply-templates select="id(@refloc)" mode="reference"/>
- </b></a>
- </xsl:template>
-
- <xsl:template match="ftnote" mode="reference">
- <xsl:text>[</xsl:text>
- <xsl:value-of select="count(preceding::ftnote)+count(ancestor::ftnote)+1"/>
- <xsl:text>]</xsl:text>
- </xsl:template>
-
- <xsl:template match="ftnote"/>
-
- <xsl:template match="ftnote" mode="footerStart">
- <h2 class="ftnoteHeader">
- <a name="S.Footnotes">Footnotes</a>
- </h2>
- <ol class="ftnote" type="1">
- <xsl:apply-templates select="//ftnote" mode="footer"/>
- </ol>
- </xsl:template>
-
- <xsl:template match="ftnote" mode="footer">
- <li>
- <xsl:apply-templates select="@id"/>
- <xsl:apply-templates/>
- </li>
- </xsl:template>
-
- <!-- Internal links -->
- <xsl:template match="xref">
- <a href="#{@refloc}" class="xref"><b>
- <xsl:apply-templates select="id(@refloc)" mode="reference"/>
- </b></a>
- <xsl:text> </xsl:text>
- </xsl:template>
-
- <xsl:template match="figure" mode="reference">
- <xsl:text>Fig. </xsl:text>
- <xsl:value-of select="count(preceding::figure)+1"/>
- </xsl:template>
-
- <xsl:template match="table" mode="reference">
- <xsl:text>Table </xsl:text>
- <xsl:value-of select="count(preceding::table)+count(ancestor::table)+1"/>
- </xsl:template>
-
- <xsl:template match="section" mode="reference">
- <xsl:choose>
- <xsl:when test="/gcapaper/@secnumbers='1'">
- <xsl:text>Chapter </xsl:text>
- <xsl:value-of select="count(preceding::section)+1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="title//text()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="subsec1|subsec2|subsec3" mode="reference">
- <xsl:choose>
- <xsl:when test="/gcapaper/@secnumbers='1'">
- <xsl:text>Section </xsl:text>
- <xsl:number level="multiple" format="1.1.1.1"
- count="section|subsec1|subsec2|subsec3"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="title//text()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- The table element and its descendants are copied -->
- <xsl:template match="table">
- <xsl:apply-templates select="@id"/>
- <div align="center">
- <xsl:copy>
- <xsl:attribute name="class">table</xsl:attribute>
- <xsl:apply-templates select="*|@*|text()" mode="copy"/>
- </xsl:copy>
- </div>
- <blockquote class="tableHeader">
- <div align="center">
- <b>
- <xsl:text>Table </xsl:text>
- <xsl:value-of select="count(preceding::table)+count(ancestor::table)+1"/>
- </b>
- </div>
- </blockquote>
- </xsl:template>
-
- <xsl:template match="td|th|caption" mode="copy">
- <xsl:copy>
- <xsl:apply-templates select="@*" mode="copy"/>
- <!-- Resume normal translation upon exit of table module -->
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="*|@*|text()" mode="copy">
- <xsl:copy>
- <xsl:apply-templates select="*|@*|text()" mode="copy"/>
- </xsl:copy>
- </xsl:template>
-
- <!-- Figures -->
- <xsl:template match="figure">
- <div class="figure">
- <xsl:apply-templates select="@id"/>
- <xsl:apply-templates select="graphic|code.block|para"/>
- <xsl:apply-templates select="title|figcaption"/>
- </div>
- </xsl:template>
-
- <xsl:template match="figure/title">
- <blockquote class="figureTitle">
- <div align="center">
- <b>
- <xsl:text>Fig. </xsl:text>
- <xsl:value-of select="count(preceding::figure)+1"/>
- <xsl:text>: </xsl:text>
- <xsl:apply-templates/>
- </b>
- </div>
- </blockquote>
- </xsl:template>
-
- <xsl:template match="figcaption">
- <blockquote class="figcaption">
- <xsl:apply-templates/>
- </blockquote>
- </xsl:template>
-
- <xsl:template match="figcaption/para">
- <p align="justify" class="figcaptionPara">
- <xsl:apply-templates/>
- </p>
- </xsl:template>
-
- <xsl:template match="figure/para">
- <blockquote class="figurePara">
- <xsl:apply-templates/>
- </blockquote>
- </xsl:template>
-
- <xsl:template match="figure/code.block">
- <blockquote class="figureCodeBlock">
- <pre>
- <xsl:apply-templates/>
- </pre>
- </blockquote>
- </xsl:template>
-
- <xsl:template match="graphic">
- <div align="center" class="graphic">
- <xsl:call-template name="Image"/>
- </div>
- </xsl:template>
-
- <xsl:template name="Image" match="inline.graphic">
- <img>
- <xsl:choose>
- <xsl:when test="boolean(@href)">
- <!-- If there is an href attribute, use it directly -->
- <xsl:attribute name="alt">
- <xsl:value-of select="@href"/>
- </xsl:attribute>
- <xsl:attribute name="src">
- <xsl:value-of select="@href"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <!-- Otherwise, there is a figname attribute that takes an entity -->
- <xsl:attribute name="alt">
- <xsl:value-of select="@figname"/>
- </xsl:attribute>
- <xsl:attribute name="src">
- <!-- Compute the relative URI of the graphic file -->
- <xsl:call-template name="SubstringAfterLast">
- <xsl:with-param name="string" select="unparsed-entity-uri(@figname)"/>
- <xsl:with-param name="token" select="'/'"/>
- </xsl:call-template>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <!-- If scaled, use given height and width numbers as pixels.
- When height and width are given in CSS units (e.g. "6in"), compute
- pixels assuming 96dpi. When in unrecognized units, set width="100%" -->
- <xsl:if test="@scalefit='1'">
- <xsl:variable name="pixelWidth">
- <xsl:call-template name="ConvertToPixels">
- <xsl:with-param name="length" select="@width"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="pixelHeight">
- <xsl:call-template name="ConvertToPixels">
- <xsl:with-param name="length" select="@height"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="number($pixelWidth) > 0 or number($pixelHeight) > 0">
- <xsl:if test="number($pixelWidth) > 0">
- <xsl:attribute name="width">
- <xsl:value-of select="$pixelWidth"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="number($pixelHeight) > 0">
- <xsl:attribute name="height">
- <xsl:value-of select="$pixelHeight"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="width">100%</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </img>
- </xsl:template>
-
- <!-- Utility function to convert lengths to pixels -->
- <xsl:template name="ConvertToPixels">
- <xsl:param name="length"/>
- <xsl:variable name="pixels" select="number(substring-before($length,'px'))"/>
- <xsl:variable name="inches" select="number(substring-before($length,'in'))"/>
- <xsl:variable name="cms" select="number(substring-before($length,'cm'))"/>
- <xsl:variable name="mms" select="number(substring-before($length,'mm'))"/>
- <xsl:variable name="pts" select="number(substring-before($length,'pt'))"/>
- <xsl:variable name="picas" select="number(substring-before($length,'pc'))"/>
- <xsl:choose>
- <xsl:when test="boolean(number($length))">
- <xsl:value-of select="$length"/>
- </xsl:when>
- <xsl:when test="boolean($pixels)">
- <xsl:value-of select="$pixels"/>
- </xsl:when>
- <xsl:when test="boolean($inches)">
- <xsl:value-of select="96 * $inches"/>
- </xsl:when>
- <xsl:when test="boolean($cms)">
- <xsl:value-of select="(96 * $cms) div 2.54"/>
- </xsl:when>
- <xsl:when test="boolean($mms)">
- <xsl:value-of select="(96 * $mms) div 25.4"/>
- </xsl:when>
- <xsl:when test="boolean($pts)">
- <xsl:value-of select="(96 * $pts) div 72"/>
- </xsl:when>
- <xsl:when test="boolean($picas)">
- <xsl:value-of select="(96 * $picas) div 6"/>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- Utility function to find the substring after the last occurrence of a token -->
- <xsl:template name="SubstringAfterLast">
- <xsl:param name="string"/>
- <xsl:param name="token"/>
- <xsl:choose>
- <xsl:when test="contains($string,$token)">
- <xsl:call-template name="SubstringAfterLast">
- <xsl:with-param name="string" select="substring-after($string,$token)"/>
- <xsl:with-param name="token" select="$token"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$string"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- Section/subsection titles become h1, h2, h3, h4
- The titles are numbered if the secnumbers attribute is 1
- Two kinds of anchors are generated at each heading:
- 1. An anchor whose name is the section id attribute, if it exists
- 2. A unique numerical anchor used by Table of Contents -->
- <xsl:template match="section|subsec1|subsec2|subsec3">
- <xsl:apply-templates select="keyword[1]|*[not(self::keyword)]"/>
- </xsl:template>
-
- <xsl:template match="section/title">
- <h2>
- <xsl:call-template name="anchoredNumberedTitle">
- <xsl:with-param name="prefix">
- <xsl:number level="single" format="1."
- count="section"/>
- </xsl:with-param>
- </xsl:call-template>
- </h2>
- </xsl:template>
-
- <xsl:template match="subsec1/title">
- <h3>
- <xsl:call-template name="anchoredNumberedTitle">
- <xsl:with-param name="prefix">
- <xsl:number level="multiple" format="1.1"
- count="section|subsec1"/>
- </xsl:with-param>
- </xsl:call-template>
- </h3>
- </xsl:template>
-
- <xsl:template match="subsec2/title">
- <h4>
- <xsl:call-template name="anchoredNumberedTitle">
- <xsl:with-param name="prefix">
- <xsl:number level="multiple" format="1.1.1"
- count="section|subsec1|subsec2"/>
- </xsl:with-param>
- </xsl:call-template>
- </h4>
- </xsl:template>
-
- <xsl:template match="subsec3/title">
- <h5>
- <xsl:call-template name="anchoredNumberedTitle">
- <xsl:with-param name="prefix">
- <xsl:number level="multiple" format="1.1.1.1"
- count="section|subsec1|subsec2|subsec3"/>
- </xsl:with-param>
- </xsl:call-template>
- </h5>
- </xsl:template>
-
- <xsl:template name="anchoredNumberedTitle">
- <xsl:param name="prefix"/>
- <xsl:apply-templates select="../@id"/>
- <a name="S{$prefix}">
- <xsl:if test="/gcapaper/@secnumbers='1'">
- <xsl:value-of select="$prefix"/>
- <xsl:text> </xsl:text>
- </xsl:if>
- <xsl:apply-templates/>
- </a>
- </xsl:template>
-
- <xsl:template match="section/keyword[1]|subsec1/keyword[1]
- |subsec2/keyword[1]|subsec3/keyword[1]">
- <p class="sectKeyword">
- <i class="sectKeywordHeader"><xsl:text>Keywords: </xsl:text></i>
- <xsl:apply-templates/>
- <xsl:apply-templates select="following-sibling::keyword"/>
- </p>
- </xsl:template>
-
- <!-- Table of Contents -->
- <xsl:template match="title" mode="toc"/>
-
- <xsl:template match="section/title" mode="toc">
- <b>
- <xsl:call-template name="linkedNumberedTitle">
- <xsl:with-param name="prefix">
- <xsl:number level="single" format="1."
- count="section"/>
- </xsl:with-param>
- </xsl:call-template>
- </b>
- <br/>
- </xsl:template>
-
- <xsl:template match="subsec1/title" mode="toc">
- <xsl:text disable-output-escaping="yes">
- <![CDATA[ ]]>
- </xsl:text>
- <xsl:call-template name="linkedNumberedTitle">
- <xsl:with-param name="prefix">
- <xsl:number level="multiple" format="1.1"
- count="section|subsec1"/>
- </xsl:with-param>
- </xsl:call-template>
- <br/>
- </xsl:template>
-
- <xsl:template match="subsec2/title" mode="toc">
- <xsl:text disable-output-escaping="yes">
- <![CDATA[ ]]>
- </xsl:text>
- <xsl:call-template name="linkedNumberedTitle">
- <xsl:with-param name="prefix">
- <xsl:number level="multiple" format="1.1.1"
- count="section|subsec1|subsec2"/>
- </xsl:with-param>
- </xsl:call-template>
- <br/>
- </xsl:template>
-
- <xsl:template match="subsec3/title" mode="toc">
- <xsl:text disable-output-escaping="yes">
- <![CDATA[
- ]]>
- </xsl:text>
- <xsl:call-template name="linkedNumberedTitle">
- <xsl:with-param name="prefix">
- <xsl:number level="multiple" format="1.1.1.1"
- count="section|subsec1|subsec2|subsec3"/>
- </xsl:with-param>
- </xsl:call-template>
- <br/>
- </xsl:template>
-
- <xsl:template name="linkedNumberedTitle">
- <xsl:param name="prefix"/>
- <a href="#S{$prefix}">
- <xsl:if test="/gcapaper/@secnumbers='1'">
- <xsl:value-of select="$prefix"/>
- <xsl:text> </xsl:text>
- </xsl:if>
- <xsl:apply-templates mode="titleText"/>
- </a>
- </xsl:template>
-
- <xsl:template match="expansion|ftnote" mode="titleText"/>
-
- <xsl:template match="text()" mode="titleText">
- <xsl:value-of select="."/>
- </xsl:template>
-
- <xsl:template match="ftnote" mode="toc">
- <b><a href="#S.Footnotes">Footnotes</a></b>
- <br/>
- </xsl:template>
-
- <xsl:template match="acknowl" mode="toc">
- <b><a href="#S.Acknowledgements">Acknowledgements</a></b>
- <br/>
- </xsl:template>
-
- <xsl:template match="bibliog" mode="toc">
- <b><a href="#S.Bibliography">Bibliography</a></b>
- <br/>
- </xsl:template>
-
- <xsl:template match="keyword">
- </xsl:template>
- </xsl:stylesheet>
-