[2] | 1 | <?xml version="1.0" encoding="US-ASCII"?>
|
---|
| 2 | <!--This file was created automatically by xsl2profile-->
|
---|
| 3 | <!--from the DocBook XSL stylesheets. Do not edit this file.-->
|
---|
| 4 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exslt="http://exslt.org/common" exslt:dummy="dummy" extension-element-prefixes="exslt" version="1.0" exclude-result-prefixes="exsl cf ng db exslt">
|
---|
| 5 |
|
---|
| 6 | <!-- ********************************************************************
|
---|
| 7 | $Id: chunk-code.xsl,v 1.14 2005/08/04 07:03:47 bobstayton Exp $
|
---|
| 8 | ********************************************************************
|
---|
| 9 |
|
---|
| 10 | This file is part of the XSL DocBook Stylesheet distribution.
|
---|
| 11 | See ../README or http://nwalsh.com/docbook/xsl/ for copyright
|
---|
| 12 | and other information.
|
---|
| 13 |
|
---|
| 14 | ******************************************************************** -->
|
---|
| 15 |
|
---|
| 16 | <!-- ==================================================================== -->
|
---|
| 17 |
|
---|
| 18 | <xsl:param name="onechunk" select="0"/>
|
---|
| 19 | <xsl:param name="refentry.separator" select="0"/>
|
---|
| 20 | <xsl:param name="chunk.fast" select="0"/>
|
---|
| 21 |
|
---|
| 22 | <xsl:key name="genid" match="*" use="generate-id()"/>
|
---|
| 23 |
|
---|
| 24 | <!-- ==================================================================== -->
|
---|
| 25 |
|
---|
| 26 | <xsl:variable name="chunk.hierarchy">
|
---|
| 27 | <xsl:if test="$chunk.fast != 0">
|
---|
| 28 | <xsl:choose>
|
---|
| 29 | <xsl:when test="function-available('exsl:node-set')">
|
---|
| 30 | <xsl:message>Computing chunks...</xsl:message>
|
---|
| 31 | <xsl:apply-templates select="/*" mode="find.chunks"/>
|
---|
| 32 | </xsl:when>
|
---|
| 33 | <xsl:otherwise>
|
---|
| 34 | <xsl:message>
|
---|
| 35 | <xsl:text>Fast chunking requires exsl:node-set(). </xsl:text>
|
---|
| 36 | <xsl:text>Using "slow" chunking.</xsl:text>
|
---|
| 37 | </xsl:message>
|
---|
| 38 | </xsl:otherwise>
|
---|
| 39 | </xsl:choose>
|
---|
| 40 | </xsl:if>
|
---|
| 41 | </xsl:variable>
|
---|
| 42 |
|
---|
| 43 | <xsl:template match="*" mode="find.chunks">
|
---|
| 44 | <xsl:variable name="chunk">
|
---|
| 45 | <xsl:call-template name="chunk"/>
|
---|
| 46 | </xsl:variable>
|
---|
| 47 |
|
---|
| 48 | <xsl:choose>
|
---|
| 49 | <xsl:when test="$chunk != 0">
|
---|
| 50 | <cf:div class="{local-name(.)}" id="{generate-id()}">
|
---|
| 51 | <xsl:apply-templates select="*" mode="find.chunks"/>
|
---|
| 52 | </cf:div>
|
---|
| 53 | </xsl:when>
|
---|
| 54 | <xsl:otherwise>
|
---|
| 55 | <xsl:apply-templates select="*" mode="find.chunks"/>
|
---|
| 56 | </xsl:otherwise>
|
---|
| 57 | </xsl:choose>
|
---|
| 58 | </xsl:template>
|
---|
| 59 |
|
---|
| 60 | <!-- ==================================================================== -->
|
---|
| 61 |
|
---|
| 62 | <xsl:template name="process-chunk-element">
|
---|
| 63 | <xsl:param name="content">
|
---|
| 64 | <xsl:apply-imports/>
|
---|
| 65 | </xsl:param>
|
---|
| 66 |
|
---|
| 67 | <xsl:choose>
|
---|
| 68 | <xsl:when test="$chunk.fast != 0 and function-available('exsl:node-set')">
|
---|
| 69 | <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
|
---|
| 70 | <xsl:variable name="genid" select="generate-id()"/>
|
---|
| 71 |
|
---|
| 72 | <xsl:variable name="div" select="$chunks[@id=$genid]"/>
|
---|
| 73 |
|
---|
| 74 | <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
|
---|
| 75 | <xsl:variable name="prev" select="key('genid', $prevdiv/@id)"/>
|
---|
| 76 |
|
---|
| 77 | <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
|
---|
| 78 | <xsl:variable name="next" select="key('genid', $nextdiv/@id)"/>
|
---|
| 79 |
|
---|
| 80 | <xsl:choose>
|
---|
| 81 | <xsl:when test="$onechunk != 0 and parent::*">
|
---|
| 82 | <xsl:copy-of select="$content"/>
|
---|
| 83 | </xsl:when>
|
---|
| 84 | <xsl:otherwise>
|
---|
| 85 | <xsl:call-template name="process-chunk">
|
---|
| 86 | <xsl:with-param name="prev" select="$prev"/>
|
---|
| 87 | <xsl:with-param name="next" select="$next"/>
|
---|
| 88 | <xsl:with-param name="content" select="$content"/>
|
---|
| 89 | </xsl:call-template>
|
---|
| 90 | </xsl:otherwise>
|
---|
| 91 | </xsl:choose>
|
---|
| 92 | </xsl:when>
|
---|
| 93 | <xsl:otherwise>
|
---|
| 94 | <xsl:choose>
|
---|
| 95 | <xsl:when test="$onechunk != 0 and not(parent::*)">
|
---|
| 96 | <xsl:call-template name="chunk-all-sections">
|
---|
| 97 | <xsl:with-param name="content" select="$content"/>
|
---|
| 98 | </xsl:call-template>
|
---|
| 99 | </xsl:when>
|
---|
| 100 | <xsl:when test="$onechunk != 0">
|
---|
| 101 | <xsl:copy-of select="$content"/>
|
---|
| 102 | </xsl:when>
|
---|
| 103 | <xsl:when test="$chunk.first.sections = 0">
|
---|
| 104 | <xsl:call-template name="chunk-first-section-with-parent">
|
---|
| 105 | <xsl:with-param name="content" select="$content"/>
|
---|
| 106 | </xsl:call-template>
|
---|
| 107 | </xsl:when>
|
---|
| 108 | <xsl:otherwise>
|
---|
| 109 | <xsl:call-template name="chunk-all-sections">
|
---|
| 110 | <xsl:with-param name="content" select="$content"/>
|
---|
| 111 | </xsl:call-template>
|
---|
| 112 | </xsl:otherwise>
|
---|
| 113 | </xsl:choose>
|
---|
| 114 | </xsl:otherwise>
|
---|
| 115 | </xsl:choose>
|
---|
| 116 | </xsl:template>
|
---|
| 117 |
|
---|
| 118 | <xsl:template name="process-chunk">
|
---|
| 119 | <xsl:param name="prev" select="."/>
|
---|
| 120 | <xsl:param name="next" select="."/>
|
---|
| 121 | <xsl:param name="content">
|
---|
| 122 | <xsl:apply-imports/>
|
---|
| 123 | </xsl:param>
|
---|
| 124 |
|
---|
| 125 | <xsl:variable name="ischunk">
|
---|
| 126 | <xsl:call-template name="chunk"/>
|
---|
| 127 | </xsl:variable>
|
---|
| 128 |
|
---|
| 129 | <xsl:variable name="chunkfn">
|
---|
| 130 | <xsl:if test="$ischunk='1'">
|
---|
| 131 | <xsl:apply-templates mode="chunk-filename" select="."/>
|
---|
| 132 | </xsl:if>
|
---|
| 133 | </xsl:variable>
|
---|
| 134 |
|
---|
| 135 | <xsl:if test="$ischunk='0'">
|
---|
| 136 | <xsl:message>
|
---|
| 137 | <xsl:text>Error </xsl:text>
|
---|
| 138 | <xsl:value-of select="name(.)"/>
|
---|
| 139 | <xsl:text> is not a chunk!</xsl:text>
|
---|
| 140 | </xsl:message>
|
---|
| 141 | </xsl:if>
|
---|
| 142 |
|
---|
| 143 | <xsl:variable name="filename">
|
---|
| 144 | <xsl:call-template name="make-relative-filename">
|
---|
| 145 | <xsl:with-param name="base.dir" select="$base.dir"/>
|
---|
| 146 | <xsl:with-param name="base.name" select="$chunkfn"/>
|
---|
| 147 | </xsl:call-template>
|
---|
| 148 | </xsl:variable>
|
---|
| 149 |
|
---|
| 150 | <xsl:call-template name="write.chunk">
|
---|
| 151 | <xsl:with-param name="filename" select="$filename"/>
|
---|
| 152 | <xsl:with-param name="content">
|
---|
| 153 | <xsl:call-template name="chunk-element-content">
|
---|
| 154 | <xsl:with-param name="prev" select="$prev"/>
|
---|
| 155 | <xsl:with-param name="next" select="$next"/>
|
---|
| 156 | <xsl:with-param name="content" select="$content"/>
|
---|
| 157 | </xsl:call-template>
|
---|
| 158 | </xsl:with-param>
|
---|
| 159 | <xsl:with-param name="quiet" select="$chunk.quietly"/>
|
---|
| 160 | </xsl:call-template>
|
---|
| 161 | </xsl:template>
|
---|
| 162 |
|
---|
| 163 | <xsl:template name="chunk-first-section-with-parent">
|
---|
| 164 | <xsl:param name="content">
|
---|
| 165 | <xsl:apply-imports/>
|
---|
| 166 | </xsl:param>
|
---|
| 167 |
|
---|
| 168 | <!-- These xpath expressions are really hairy. The trick is to pick sections -->
|
---|
| 169 | <!-- that are not first children and are not the children of first children -->
|
---|
| 170 |
|
---|
| 171 | <!-- Break these variables into pieces to work around
|
---|
| 172 | http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
|
---|
| 173 |
|
---|
| 174 | <xsl:variable name="prev-v1" select="(ancestor::sect1[$chunk.section.depth > 0 and preceding-sibling::sect1][1] |ancestor::sect2[$chunk.section.depth > 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |ancestor::sect3[$chunk.section.depth > 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect4[$chunk.section.depth > 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect2] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect5[$chunk.section.depth > 4 and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
|
---|
| 175 |
|
---|
| 176 | <xsl:variable name="prev-v2" select="(preceding::sect1[$chunk.section.depth > 0 and preceding-sibling::sect1][1] |preceding::sect2[$chunk.section.depth > 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |preceding::sect3[$chunk.section.depth > 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect4[$chunk.section.depth > 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect2] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect5[$chunk.section.depth > 4 and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::section[$chunk.section.depth > count(ancestor::section) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
|
---|
| 177 |
|
---|
| 178 | <xsl:variable name="prev" select="(preceding::book[1] |preceding::preface[1] |preceding::chapter[1] |preceding::appendix[1] |preceding::part[1] |preceding::reference[1] |preceding::refentry[1] |preceding::colophon[1] |preceding::article[1] |preceding::bibliography[parent::article or parent::book or parent::part][1] |preceding::glossary[parent::article or parent::book or parent::part][1] |preceding::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |preceding::setindex[$generate.index != 0][1] |ancestor::set |ancestor::book[1] |ancestor::preface[1] |ancestor::chapter[1] |ancestor::appendix[1] |ancestor::part[1] |ancestor::reference[1] |ancestor::article[1] |$prev-v1 |$prev-v2)[last()]"/>
|
---|
| 179 |
|
---|
| 180 | <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth > 0 and preceding-sibling::sect1][1] |following::sect2[$chunk.section.depth > 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |following::sect3[$chunk.section.depth > 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect4[$chunk.section.depth > 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect2] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect5[$chunk.section.depth > 4 and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::section[$chunk.section.depth > count(ancestor::section) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[1]"/>
|
---|
| 181 |
|
---|
| 182 | <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth > 0 and preceding-sibling::sect1][1] |descendant::sect2[$chunk.section.depth > 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |descendant::sect3[$chunk.section.depth > 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect4[$chunk.section.depth > 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect2] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect5[$chunk.section.depth > 4 and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::section[$chunk.section.depth > count(ancestor::section) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])])[1]"/>
|
---|
| 183 |
|
---|
| 184 | <xsl:variable name="next" select="(following::book[1] |following::preface[1] |following::chapter[1] |following::appendix[1] |following::part[1] |following::reference[1] |following::refentry[1] |following::colophon[1] |following::bibliography[parent::article or parent::book or parent::part][1] |following::glossary[parent::article or parent::book or parent::part][1] |following::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |following::article[1] |following::setindex[$generate.index != 0][1] |descendant::book[1] |descendant::preface[1] |descendant::chapter[1] |descendant::appendix[1] |descendant::article[1] |descendant::bibliography[parent::article or parent::book or parent::part][1] |descendant::glossary[parent::article or parent::book or parent::part][1] |descendant::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |descendant::colophon[1] |descendant::setindex[$generate.index != 0][1] |descendant::part[1] |descendant::reference[1] |descendant::refentry[1] |$next-v1 |$next-v2)[1]"/>
|
---|
| 185 |
|
---|
| 186 | <xsl:call-template name="process-chunk">
|
---|
| 187 | <xsl:with-param name="prev" select="$prev"/>
|
---|
| 188 | <xsl:with-param name="next" select="$next"/>
|
---|
| 189 | <xsl:with-param name="content" select="$content"/>
|
---|
| 190 | </xsl:call-template>
|
---|
| 191 | </xsl:template>
|
---|
| 192 |
|
---|
| 193 | <xsl:template name="chunk-all-sections">
|
---|
| 194 | <xsl:param name="content">
|
---|
| 195 | <xsl:apply-imports/>
|
---|
| 196 | </xsl:param>
|
---|
| 197 |
|
---|
| 198 | <xsl:variable name="prev-v1" select="(preceding::sect1[$chunk.section.depth > 0][1] |preceding::sect2[$chunk.section.depth > 1][1] |preceding::sect3[$chunk.section.depth > 2][1] |preceding::sect4[$chunk.section.depth > 3][1] |preceding::sect5[$chunk.section.depth > 4][1] |preceding::section[$chunk.section.depth > count(ancestor::section)][1])[last()]"/>
|
---|
| 199 |
|
---|
| 200 | <xsl:variable name="prev-v2" select="(ancestor::sect1[$chunk.section.depth > 0][1] |ancestor::sect2[$chunk.section.depth > 1][1] |ancestor::sect3[$chunk.section.depth > 2][1] |ancestor::sect4[$chunk.section.depth > 3][1] |ancestor::sect5[$chunk.section.depth > 4][1] |ancestor::section[$chunk.section.depth > count(ancestor::section)][1])[last()]"/>
|
---|
| 201 |
|
---|
| 202 | <xsl:variable name="prev" select="(preceding::book[1] |preceding::preface[1] |preceding::chapter[1] |preceding::appendix[1] |preceding::part[1] |preceding::reference[1] |preceding::refentry[1] |preceding::colophon[1] |preceding::article[1] |preceding::bibliography[parent::article or parent::book or parent::part][1] |preceding::glossary[parent::article or parent::book or parent::part][1] |preceding::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |preceding::setindex[$generate.index != 0][1] |ancestor::set |ancestor::book[1] |ancestor::preface[1] |ancestor::chapter[1] |ancestor::appendix[1] |ancestor::part[1] |ancestor::reference[1] |ancestor::article[1] |$prev-v1 |$prev-v2)[last()]"/>
|
---|
| 203 |
|
---|
| 204 | <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth > 0][1] |following::sect2[$chunk.section.depth > 1][1] |following::sect3[$chunk.section.depth > 2][1] |following::sect4[$chunk.section.depth > 3][1] |following::sect5[$chunk.section.depth > 4][1] |following::section[$chunk.section.depth > count(ancestor::section)][1])[1]"/>
|
---|
| 205 |
|
---|
| 206 | <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth > 0][1] |descendant::sect2[$chunk.section.depth > 1][1] |descendant::sect3[$chunk.section.depth > 2][1] |descendant::sect4[$chunk.section.depth > 3][1] |descendant::sect5[$chunk.section.depth > 4][1] |descendant::section[$chunk.section.depth > count(ancestor::section)][1])[1]"/>
|
---|
| 207 |
|
---|
| 208 | <xsl:variable name="next" select="(following::book[1] |following::preface[1] |following::chapter[1] |following::appendix[1] |following::part[1] |following::reference[1] |following::refentry[1] |following::colophon[1] |following::bibliography[parent::article or parent::book or parent::part][1] |following::glossary[parent::article or parent::book or parent::part][1] |following::index[$generate.index != 0] [parent::article or parent::book][1] |following::article[1] |following::setindex[$generate.index != 0][1] |descendant::book[1] |descendant::preface[1] |descendant::chapter[1] |descendant::appendix[1] |descendant::article[1] |descendant::bibliography[parent::article or parent::book][1] |descendant::glossary[parent::article or parent::book or parent::part][1] |descendant::index[$generate.index != 0] [parent::article or parent::book][1] |descendant::colophon[1] |descendant::setindex[$generate.index != 0][1] |descendant::part[1] |descendant::reference[1] |descendant::refentry[1] |$next-v1 |$next-v2)[1]"/>
|
---|
| 209 |
|
---|
| 210 | <xsl:call-template name="process-chunk">
|
---|
| 211 | <xsl:with-param name="prev" select="$prev"/>
|
---|
| 212 | <xsl:with-param name="next" select="$next"/>
|
---|
| 213 | <xsl:with-param name="content" select="$content"/>
|
---|
| 214 | </xsl:call-template>
|
---|
| 215 | </xsl:template>
|
---|
| 216 |
|
---|
| 217 | <!-- ==================================================================== -->
|
---|
| 218 |
|
---|
| 219 | <xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xsl:template match="/"><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:apply-templates select="." mode="profile"/></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/>
|
---|
| 220 | <xsl:choose>
|
---|
| 221 | <xsl:when test="function-available('exsl:node-set') and (*/self::ng:* or */self::db:*)">
|
---|
| 222 | <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
|
---|
| 223 | toss the namespace and continue. Someday we'll reverse this logic
|
---|
| 224 | and add the namespace to documents that don't have one.
|
---|
| 225 | But not before the whole stylesheet has been converted to use
|
---|
| 226 | namespaces. i.e., don't hold your breath -->
|
---|
| 227 | <xsl:message>Stripping NS from DocBook 5/NG document.</xsl:message>
|
---|
| 228 | <xsl:variable name="nons">
|
---|
| 229 | <xsl:apply-templates mode="stripNS"/>
|
---|
| 230 | </xsl:variable>
|
---|
| 231 | <xsl:message>Processing stripped document.</xsl:message>
|
---|
| 232 | <xsl:apply-templates select="exsl:node-set($nons)"/>
|
---|
| 233 | </xsl:when>
|
---|
| 234 | <xsl:otherwise>
|
---|
| 235 | <xsl:choose>
|
---|
| 236 | <xsl:when test="$rootid != ''">
|
---|
| 237 | <xsl:choose>
|
---|
| 238 | <xsl:when test="count($profiled-nodes//*[@id=$rootid]) = 0">
|
---|
| 239 | <xsl:message terminate="yes">
|
---|
| 240 | <xsl:text>ID '</xsl:text>
|
---|
| 241 | <xsl:value-of select="$rootid"/>
|
---|
| 242 | <xsl:text>' not found in document.</xsl:text>
|
---|
| 243 | </xsl:message>
|
---|
| 244 | </xsl:when>
|
---|
| 245 | <xsl:otherwise>
|
---|
| 246 | <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
|
---|
| 247 | <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
|
---|
| 248 | </xsl:if>
|
---|
| 249 | <xsl:if test="$collect.xref.targets != 'only'">
|
---|
| 250 | <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="process.root"/>
|
---|
| 251 | <xsl:if test="$tex.math.in.alt != ''">
|
---|
| 252 | <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="collect.tex.math"/>
|
---|
| 253 | </xsl:if>
|
---|
| 254 | <xsl:if test="$generate.manifest != 0">
|
---|
| 255 | <xsl:call-template name="generate.manifest">
|
---|
| 256 | <xsl:with-param name="node" select="key('id',$rootid)"/>
|
---|
| 257 | </xsl:call-template>
|
---|
| 258 | </xsl:if>
|
---|
| 259 | </xsl:if>
|
---|
| 260 | </xsl:otherwise>
|
---|
| 261 | </xsl:choose>
|
---|
| 262 | </xsl:when>
|
---|
| 263 | <xsl:otherwise>
|
---|
| 264 | <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
|
---|
| 265 | <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
|
---|
| 266 | </xsl:if>
|
---|
| 267 | <xsl:if test="$collect.xref.targets != 'only'">
|
---|
| 268 | <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
|
---|
| 269 | <xsl:if test="$tex.math.in.alt != ''">
|
---|
| 270 | <xsl:apply-templates select="$profiled-nodes" mode="collect.tex.math"/>
|
---|
| 271 | </xsl:if>
|
---|
| 272 | <xsl:if test="$generate.manifest != 0">
|
---|
| 273 | <xsl:call-template name="generate.manifest">
|
---|
| 274 | <xsl:with-param name="node" select="$profiled-nodes"/>
|
---|
| 275 | </xsl:call-template>
|
---|
| 276 | </xsl:if>
|
---|
| 277 | </xsl:if>
|
---|
| 278 | </xsl:otherwise>
|
---|
| 279 | </xsl:choose>
|
---|
| 280 | </xsl:otherwise>
|
---|
| 281 | </xsl:choose>
|
---|
| 282 | </xsl:template>
|
---|
| 283 |
|
---|
| 284 | <xsl:template match="*" mode="process.root">
|
---|
| 285 | <xsl:apply-templates select="."/>
|
---|
| 286 | </xsl:template>
|
---|
| 287 |
|
---|
| 288 | <!-- ====================================================================== -->
|
---|
| 289 |
|
---|
| 290 | <xsl:template match="set|book|part|preface|chapter|appendix |article |reference|refentry |book/glossary|article/glossary|part/glossary |book/bibliography|article/bibliography|part/bibliography |colophon">
|
---|
| 291 | <xsl:choose>
|
---|
| 292 | <xsl:when test="$onechunk != 0 and parent::*">
|
---|
| 293 | <xsl:apply-imports/>
|
---|
| 294 | </xsl:when>
|
---|
| 295 | <xsl:otherwise>
|
---|
| 296 | <xsl:call-template name="process-chunk-element"/>
|
---|
| 297 | </xsl:otherwise>
|
---|
| 298 | </xsl:choose>
|
---|
| 299 | </xsl:template>
|
---|
| 300 |
|
---|
| 301 | <xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
|
---|
| 302 | <xsl:variable name="ischunk">
|
---|
| 303 | <xsl:call-template name="chunk"/>
|
---|
| 304 | </xsl:variable>
|
---|
| 305 |
|
---|
| 306 | <xsl:choose>
|
---|
| 307 | <xsl:when test="not(parent::*)">
|
---|
| 308 | <xsl:call-template name="process-chunk-element"/>
|
---|
| 309 | </xsl:when>
|
---|
| 310 | <xsl:when test="$ischunk = 0">
|
---|
| 311 | <xsl:apply-imports/>
|
---|
| 312 | </xsl:when>
|
---|
| 313 | <xsl:otherwise>
|
---|
| 314 | <xsl:call-template name="process-chunk-element"/>
|
---|
| 315 | </xsl:otherwise>
|
---|
| 316 | </xsl:choose>
|
---|
| 317 | </xsl:template>
|
---|
| 318 |
|
---|
| 319 | <xsl:template match="setindex |book/index |article/index |part/index">
|
---|
| 320 | <!-- some implementations use completely empty index tags to indicate -->
|
---|
| 321 | <!-- where an automatically generated index should be inserted. so -->
|
---|
| 322 | <!-- if the index is completely empty, skip it. -->
|
---|
| 323 | <xsl:if test="count(*)>0 or $generate.index != '0'">
|
---|
| 324 | <xsl:call-template name="process-chunk-element"/>
|
---|
| 325 | </xsl:if>
|
---|
| 326 | </xsl:template>
|
---|
| 327 |
|
---|
| 328 | <!-- ==================================================================== -->
|
---|
| 329 |
|
---|
| 330 | <xsl:template name="make.lots">
|
---|
| 331 | <xsl:param name="toc.params" select="''"/>
|
---|
| 332 | <xsl:param name="toc"/>
|
---|
| 333 |
|
---|
| 334 | <xsl:variable name="lots">
|
---|
| 335 | <xsl:if test="contains($toc.params, 'toc')">
|
---|
| 336 | <xsl:copy-of select="$toc"/>
|
---|
| 337 | </xsl:if>
|
---|
| 338 |
|
---|
| 339 | <xsl:if test="contains($toc.params, 'figure')">
|
---|
| 340 | <xsl:choose>
|
---|
| 341 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
| 342 | <xsl:call-template name="make.lot.chunk">
|
---|
| 343 | <xsl:with-param name="type" select="'figure'"/>
|
---|
| 344 | <xsl:with-param name="lot">
|
---|
| 345 | <xsl:call-template name="list.of.titles">
|
---|
| 346 | <xsl:with-param name="titles" select="'figure'"/>
|
---|
| 347 | <xsl:with-param name="nodes" select=".//figure"/>
|
---|
| 348 | </xsl:call-template>
|
---|
| 349 | </xsl:with-param>
|
---|
| 350 | </xsl:call-template>
|
---|
| 351 | </xsl:when>
|
---|
| 352 | <xsl:otherwise>
|
---|
| 353 | <xsl:call-template name="list.of.titles">
|
---|
| 354 | <xsl:with-param name="titles" select="'figure'"/>
|
---|
| 355 | <xsl:with-param name="nodes" select=".//figure"/>
|
---|
| 356 | </xsl:call-template>
|
---|
| 357 | </xsl:otherwise>
|
---|
| 358 | </xsl:choose>
|
---|
| 359 | </xsl:if>
|
---|
| 360 |
|
---|
| 361 | <xsl:if test="contains($toc.params, 'table')">
|
---|
| 362 | <xsl:choose>
|
---|
| 363 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
| 364 | <xsl:call-template name="make.lot.chunk">
|
---|
| 365 | <xsl:with-param name="type" select="'table'"/>
|
---|
| 366 | <xsl:with-param name="lot">
|
---|
| 367 | <xsl:call-template name="list.of.titles">
|
---|
| 368 | <xsl:with-param name="titles" select="'table'"/>
|
---|
| 369 | <xsl:with-param name="nodes" select=".//table"/>
|
---|
| 370 | </xsl:call-template>
|
---|
| 371 | </xsl:with-param>
|
---|
| 372 | </xsl:call-template>
|
---|
| 373 | </xsl:when>
|
---|
| 374 | <xsl:otherwise>
|
---|
| 375 | <xsl:call-template name="list.of.titles">
|
---|
| 376 | <xsl:with-param name="titles" select="'table'"/>
|
---|
| 377 | <xsl:with-param name="nodes" select=".//table"/>
|
---|
| 378 | </xsl:call-template>
|
---|
| 379 | </xsl:otherwise>
|
---|
| 380 | </xsl:choose>
|
---|
| 381 | </xsl:if>
|
---|
| 382 |
|
---|
| 383 | <xsl:if test="contains($toc.params, 'example')">
|
---|
| 384 | <xsl:choose>
|
---|
| 385 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
| 386 | <xsl:call-template name="make.lot.chunk">
|
---|
| 387 | <xsl:with-param name="type" select="'example'"/>
|
---|
| 388 | <xsl:with-param name="lot">
|
---|
| 389 | <xsl:call-template name="list.of.titles">
|
---|
| 390 | <xsl:with-param name="titles" select="'example'"/>
|
---|
| 391 | <xsl:with-param name="nodes" select=".//example"/>
|
---|
| 392 | </xsl:call-template>
|
---|
| 393 | </xsl:with-param>
|
---|
| 394 | </xsl:call-template>
|
---|
| 395 | </xsl:when>
|
---|
| 396 | <xsl:otherwise>
|
---|
| 397 | <xsl:call-template name="list.of.titles">
|
---|
| 398 | <xsl:with-param name="titles" select="'example'"/>
|
---|
| 399 | <xsl:with-param name="nodes" select=".//example"/>
|
---|
| 400 | </xsl:call-template>
|
---|
| 401 | </xsl:otherwise>
|
---|
| 402 | </xsl:choose>
|
---|
| 403 | </xsl:if>
|
---|
| 404 |
|
---|
| 405 | <xsl:if test="contains($toc.params, 'equation')">
|
---|
| 406 | <xsl:choose>
|
---|
| 407 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
| 408 | <xsl:call-template name="make.lot.chunk">
|
---|
| 409 | <xsl:with-param name="type" select="'equation'"/>
|
---|
| 410 | <xsl:with-param name="lot">
|
---|
| 411 | <xsl:call-template name="list.of.titles">
|
---|
| 412 | <xsl:with-param name="titles" select="'equation'"/>
|
---|
| 413 | <xsl:with-param name="nodes" select=".//equation"/>
|
---|
| 414 | </xsl:call-template>
|
---|
| 415 | </xsl:with-param>
|
---|
| 416 | </xsl:call-template>
|
---|
| 417 | </xsl:when>
|
---|
| 418 | <xsl:otherwise>
|
---|
| 419 | <xsl:call-template name="list.of.titles">
|
---|
| 420 | <xsl:with-param name="titles" select="'equation'"/>
|
---|
| 421 | <xsl:with-param name="nodes" select=".//equation"/>
|
---|
| 422 | </xsl:call-template>
|
---|
| 423 | </xsl:otherwise>
|
---|
| 424 | </xsl:choose>
|
---|
| 425 | </xsl:if>
|
---|
| 426 |
|
---|
| 427 | <xsl:if test="contains($toc.params, 'procedure')">
|
---|
| 428 | <xsl:choose>
|
---|
| 429 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
| 430 | <xsl:call-template name="make.lot.chunk">
|
---|
| 431 | <xsl:with-param name="type" select="'procedure'"/>
|
---|
| 432 | <xsl:with-param name="lot">
|
---|
| 433 | <xsl:call-template name="list.of.titles">
|
---|
| 434 | <xsl:with-param name="titles" select="'procedure'"/>
|
---|
| 435 | <xsl:with-param name="nodes" select=".//procedure[title]"/>
|
---|
| 436 | </xsl:call-template>
|
---|
| 437 | </xsl:with-param>
|
---|
| 438 | </xsl:call-template>
|
---|
| 439 | </xsl:when>
|
---|
| 440 | <xsl:otherwise>
|
---|
| 441 | <xsl:call-template name="list.of.titles">
|
---|
| 442 | <xsl:with-param name="titles" select="'procedure'"/>
|
---|
| 443 | <xsl:with-param name="nodes" select=".//procedure[title]"/>
|
---|
| 444 | </xsl:call-template>
|
---|
| 445 | </xsl:otherwise>
|
---|
| 446 | </xsl:choose>
|
---|
| 447 | </xsl:if>
|
---|
| 448 | </xsl:variable>
|
---|
| 449 |
|
---|
| 450 | <xsl:if test="string($lots) != ''">
|
---|
| 451 | <xsl:choose>
|
---|
| 452 | <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
|
---|
| 453 | <xsl:call-template name="write.chunk">
|
---|
| 454 | <xsl:with-param name="filename">
|
---|
| 455 | <xsl:call-template name="make-relative-filename">
|
---|
| 456 | <xsl:with-param name="base.dir" select="$base.dir"/>
|
---|
| 457 | <xsl:with-param name="base.name">
|
---|
| 458 | <xsl:call-template name="dbhtml-dir"/>
|
---|
| 459 | <xsl:apply-templates select="." mode="recursive-chunk-filename">
|
---|
| 460 | <xsl:with-param name="recursive" select="true()"/>
|
---|
| 461 | </xsl:apply-templates>
|
---|
| 462 | <xsl:text>-toc</xsl:text>
|
---|
| 463 | <xsl:value-of select="$html.ext"/>
|
---|
| 464 | </xsl:with-param>
|
---|
| 465 | </xsl:call-template>
|
---|
| 466 | </xsl:with-param>
|
---|
| 467 | <xsl:with-param name="content">
|
---|
| 468 | <xsl:call-template name="chunk-element-content">
|
---|
| 469 | <xsl:with-param name="prev" select="/foo"/>
|
---|
| 470 | <xsl:with-param name="next" select="/foo"/>
|
---|
| 471 | <xsl:with-param name="nav.context" select="'toc'"/>
|
---|
| 472 | <xsl:with-param name="content">
|
---|
| 473 | <h1>
|
---|
| 474 | <xsl:apply-templates select="." mode="object.title.markup"/>
|
---|
| 475 | </h1>
|
---|
| 476 | <xsl:copy-of select="$lots"/>
|
---|
| 477 | </xsl:with-param>
|
---|
| 478 | </xsl:call-template>
|
---|
| 479 | </xsl:with-param>
|
---|
| 480 | <xsl:with-param name="quiet" select="$chunk.quietly"/>
|
---|
| 481 | </xsl:call-template>
|
---|
| 482 | </xsl:when>
|
---|
| 483 | <xsl:otherwise>
|
---|
| 484 | <xsl:copy-of select="$lots"/>
|
---|
| 485 | </xsl:otherwise>
|
---|
| 486 | </xsl:choose>
|
---|
| 487 | </xsl:if>
|
---|
| 488 | </xsl:template>
|
---|
| 489 |
|
---|
| 490 | <xsl:template name="make.lot.chunk">
|
---|
| 491 | <xsl:param name="type" select="''"/>
|
---|
| 492 | <xsl:param name="lot"/>
|
---|
| 493 |
|
---|
| 494 | <xsl:if test="string($lot) != ''">
|
---|
| 495 | <xsl:variable name="filename">
|
---|
| 496 | <xsl:call-template name="make-relative-filename">
|
---|
| 497 | <xsl:with-param name="base.dir" select="$base.dir"/>
|
---|
| 498 | <xsl:with-param name="base.name">
|
---|
| 499 | <xsl:call-template name="dbhtml-dir"/>
|
---|
| 500 | <xsl:value-of select="$type"/>
|
---|
| 501 | <xsl:text>-toc</xsl:text>
|
---|
| 502 | <xsl:value-of select="$html.ext"/>
|
---|
| 503 | </xsl:with-param>
|
---|
| 504 | </xsl:call-template>
|
---|
| 505 | </xsl:variable>
|
---|
| 506 |
|
---|
| 507 | <xsl:variable name="href">
|
---|
| 508 | <xsl:call-template name="make-relative-filename">
|
---|
| 509 | <xsl:with-param name="base.name">
|
---|
| 510 | <xsl:call-template name="dbhtml-dir"/>
|
---|
| 511 | <xsl:value-of select="$type"/>
|
---|
| 512 | <xsl:text>-toc</xsl:text>
|
---|
| 513 | <xsl:value-of select="$html.ext"/>
|
---|
| 514 | </xsl:with-param>
|
---|
| 515 | </xsl:call-template>
|
---|
| 516 | </xsl:variable>
|
---|
| 517 |
|
---|
| 518 | <xsl:call-template name="write.chunk">
|
---|
| 519 | <xsl:with-param name="filename" select="$filename"/>
|
---|
| 520 | <xsl:with-param name="content">
|
---|
| 521 | <xsl:call-template name="chunk-element-content">
|
---|
| 522 | <xsl:with-param name="prev" select="/foo"/>
|
---|
| 523 | <xsl:with-param name="next" select="/foo"/>
|
---|
| 524 | <xsl:with-param name="nav.context" select="'toc'"/>
|
---|
| 525 | <xsl:with-param name="content">
|
---|
| 526 | <xsl:copy-of select="$lot"/>
|
---|
| 527 | </xsl:with-param>
|
---|
| 528 | </xsl:call-template>
|
---|
| 529 | </xsl:with-param>
|
---|
| 530 | <xsl:with-param name="quiet" select="$chunk.quietly"/>
|
---|
| 531 | </xsl:call-template>
|
---|
| 532 | <!-- And output a link to this file -->
|
---|
| 533 | <div>
|
---|
| 534 | <xsl:attribute name="class">
|
---|
| 535 | <xsl:text>ListofTitles</xsl:text>
|
---|
| 536 | </xsl:attribute>
|
---|
| 537 | <a href="{$href}">
|
---|
| 538 | <xsl:call-template name="gentext">
|
---|
| 539 | <xsl:with-param name="key">
|
---|
| 540 | <xsl:choose>
|
---|
| 541 | <xsl:when test="$type='table'">ListofTables</xsl:when>
|
---|
| 542 | <xsl:when test="$type='figure'">ListofFigures</xsl:when>
|
---|
| 543 | <xsl:when test="$type='equation'">ListofEquations</xsl:when>
|
---|
| 544 | <xsl:when test="$type='example'">ListofExamples</xsl:when>
|
---|
| 545 | <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
|
---|
| 546 | <xsl:otherwise>ListofUnknown</xsl:otherwise>
|
---|
| 547 | </xsl:choose>
|
---|
| 548 | </xsl:with-param>
|
---|
| 549 | </xsl:call-template>
|
---|
| 550 | </a>
|
---|
| 551 | </div>
|
---|
| 552 | </xsl:if>
|
---|
| 553 | </xsl:template>
|
---|
| 554 |
|
---|
| 555 | <!-- ==================================================================== -->
|
---|
| 556 |
|
---|
| 557 | <xsl:template name="in.other.chunk">
|
---|
| 558 | <xsl:param name="chunk" select="."/>
|
---|
| 559 | <xsl:param name="node" select="."/>
|
---|
| 560 |
|
---|
| 561 | <xsl:variable name="is.chunk">
|
---|
| 562 | <xsl:call-template name="chunk">
|
---|
| 563 | <xsl:with-param name="node" select="$node"/>
|
---|
| 564 | </xsl:call-template>
|
---|
| 565 | </xsl:variable>
|
---|
| 566 |
|
---|
| 567 | <!--
|
---|
| 568 | <xsl:message>
|
---|
| 569 | <xsl:text>in.other.chunk: </xsl:text>
|
---|
| 570 | <xsl:value-of select="name($chunk)"/>
|
---|
| 571 | <xsl:text> </xsl:text>
|
---|
| 572 | <xsl:value-of select="name($node)"/>
|
---|
| 573 | <xsl:text> </xsl:text>
|
---|
| 574 | <xsl:value-of select="$chunk = $node"/>
|
---|
| 575 | <xsl:text> </xsl:text>
|
---|
| 576 | <xsl:value-of select="$is.chunk"/>
|
---|
| 577 | </xsl:message>
|
---|
| 578 | -->
|
---|
| 579 |
|
---|
| 580 | <xsl:choose>
|
---|
| 581 | <xsl:when test="$chunk = $node">0</xsl:when>
|
---|
| 582 | <xsl:when test="$is.chunk = 1">1</xsl:when>
|
---|
| 583 | <xsl:when test="count($node) = 0">0</xsl:when>
|
---|
| 584 | <xsl:otherwise>
|
---|
| 585 | <xsl:call-template name="in.other.chunk">
|
---|
| 586 | <xsl:with-param name="chunk" select="$chunk"/>
|
---|
| 587 | <xsl:with-param name="node" select="$node/parent::*"/>
|
---|
| 588 | </xsl:call-template>
|
---|
| 589 | </xsl:otherwise>
|
---|
| 590 | </xsl:choose>
|
---|
| 591 | </xsl:template>
|
---|
| 592 |
|
---|
| 593 | <xsl:template name="count.footnotes.in.this.chunk">
|
---|
| 594 | <xsl:param name="node" select="."/>
|
---|
| 595 | <xsl:param name="footnotes" select="$node//footnote"/>
|
---|
| 596 | <xsl:param name="count" select="0"/>
|
---|
| 597 |
|
---|
| 598 | <!--
|
---|
| 599 | <xsl:message>
|
---|
| 600 | <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
|
---|
| 601 | <xsl:value-of select="name($node)"/>
|
---|
| 602 | </xsl:message>
|
---|
| 603 | -->
|
---|
| 604 |
|
---|
| 605 | <xsl:variable name="in.other.chunk">
|
---|
| 606 | <xsl:call-template name="in.other.chunk">
|
---|
| 607 | <xsl:with-param name="chunk" select="$node"/>
|
---|
| 608 | <xsl:with-param name="node" select="$footnotes[1]"/>
|
---|
| 609 | </xsl:call-template>
|
---|
| 610 | </xsl:variable>
|
---|
| 611 |
|
---|
| 612 | <xsl:choose>
|
---|
| 613 | <xsl:when test="count($footnotes) = 0">
|
---|
| 614 | <xsl:value-of select="$count"/>
|
---|
| 615 | </xsl:when>
|
---|
| 616 | <xsl:otherwise>
|
---|
| 617 | <xsl:choose>
|
---|
| 618 | <xsl:when test="$in.other.chunk != 0">
|
---|
| 619 | <xsl:call-template name="count.footnotes.in.this.chunk">
|
---|
| 620 | <xsl:with-param name="node" select="$node"/>
|
---|
| 621 | <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
|
---|
| 622 | <xsl:with-param name="count" select="$count"/>
|
---|
| 623 | </xsl:call-template>
|
---|
| 624 | </xsl:when>
|
---|
| 625 | <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
|
---|
| 626 | <xsl:call-template name="count.footnotes.in.this.chunk">
|
---|
| 627 | <xsl:with-param name="node" select="$node"/>
|
---|
| 628 | <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
|
---|
| 629 | <xsl:with-param name="count" select="$count"/>
|
---|
| 630 | </xsl:call-template>
|
---|
| 631 | </xsl:when>
|
---|
| 632 | <xsl:otherwise>
|
---|
| 633 | <xsl:call-template name="count.footnotes.in.this.chunk">
|
---|
| 634 | <xsl:with-param name="node" select="$node"/>
|
---|
| 635 | <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
|
---|
| 636 | <xsl:with-param name="count" select="$count + 1"/>
|
---|
| 637 | </xsl:call-template>
|
---|
| 638 | </xsl:otherwise>
|
---|
| 639 | </xsl:choose>
|
---|
| 640 | </xsl:otherwise>
|
---|
| 641 | </xsl:choose>
|
---|
| 642 | </xsl:template>
|
---|
| 643 |
|
---|
| 644 | <xsl:template name="process.footnotes.in.this.chunk">
|
---|
| 645 | <xsl:param name="node" select="."/>
|
---|
| 646 | <xsl:param name="footnotes" select="$node//footnote"/>
|
---|
| 647 |
|
---|
| 648 | <!--
|
---|
| 649 | <xsl:message>process.footnotes.in.this.chunk</xsl:message>
|
---|
| 650 | -->
|
---|
| 651 |
|
---|
| 652 | <xsl:variable name="in.other.chunk">
|
---|
| 653 | <xsl:call-template name="in.other.chunk">
|
---|
| 654 | <xsl:with-param name="chunk" select="$node"/>
|
---|
| 655 | <xsl:with-param name="node" select="$footnotes[1]"/>
|
---|
| 656 | </xsl:call-template>
|
---|
| 657 | </xsl:variable>
|
---|
| 658 |
|
---|
| 659 | <xsl:choose>
|
---|
| 660 | <xsl:when test="count($footnotes) = 0">
|
---|
| 661 | <!-- nop -->
|
---|
| 662 | </xsl:when>
|
---|
| 663 | <xsl:otherwise>
|
---|
| 664 | <xsl:choose>
|
---|
| 665 | <xsl:when test="$in.other.chunk != 0">
|
---|
| 666 | <xsl:call-template name="process.footnotes.in.this.chunk">
|
---|
| 667 | <xsl:with-param name="node" select="$node"/>
|
---|
| 668 | <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
|
---|
| 669 | </xsl:call-template>
|
---|
| 670 | </xsl:when>
|
---|
| 671 | <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
|
---|
| 672 | <xsl:call-template name="process.footnotes.in.this.chunk">
|
---|
| 673 | <xsl:with-param name="node" select="$node"/>
|
---|
| 674 | <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
|
---|
| 675 | </xsl:call-template>
|
---|
| 676 | </xsl:when>
|
---|
| 677 | <xsl:otherwise>
|
---|
| 678 | <xsl:apply-templates select="$footnotes[1]" mode="process.footnote.mode"/>
|
---|
| 679 | <xsl:call-template name="process.footnotes.in.this.chunk">
|
---|
| 680 | <xsl:with-param name="node" select="$node"/>
|
---|
| 681 | <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
|
---|
| 682 | </xsl:call-template>
|
---|
| 683 | </xsl:otherwise>
|
---|
| 684 | </xsl:choose>
|
---|
| 685 | </xsl:otherwise>
|
---|
| 686 | </xsl:choose>
|
---|
| 687 | </xsl:template>
|
---|
| 688 |
|
---|
| 689 | <xsl:template name="process.footnotes">
|
---|
| 690 | <xsl:variable name="footnotes" select=".//footnote"/>
|
---|
| 691 | <xsl:variable name="fcount">
|
---|
| 692 | <xsl:call-template name="count.footnotes.in.this.chunk">
|
---|
| 693 | <xsl:with-param name="node" select="."/>
|
---|
| 694 | <xsl:with-param name="footnotes" select="$footnotes"/>
|
---|
| 695 | </xsl:call-template>
|
---|
| 696 | </xsl:variable>
|
---|
| 697 |
|
---|
| 698 | <!--
|
---|
| 699 | <xsl:message>
|
---|
| 700 | <xsl:value-of select="name(.)"/>
|
---|
| 701 | <xsl:text> fcount: </xsl:text>
|
---|
| 702 | <xsl:value-of select="$fcount"/>
|
---|
| 703 | </xsl:message>
|
---|
| 704 | -->
|
---|
| 705 |
|
---|
| 706 | <!-- Only bother to do this if there's at least one non-table footnote -->
|
---|
| 707 | <xsl:if test="$fcount > 0">
|
---|
| 708 | <div class="footnotes">
|
---|
| 709 | <br/>
|
---|
| 710 | <hr width="100" align="left"/>
|
---|
| 711 | <xsl:call-template name="process.footnotes.in.this.chunk">
|
---|
| 712 | <xsl:with-param name="node" select="."/>
|
---|
| 713 | <xsl:with-param name="footnotes" select="$footnotes"/>
|
---|
| 714 | </xsl:call-template>
|
---|
| 715 | </div>
|
---|
| 716 | </xsl:if>
|
---|
| 717 |
|
---|
| 718 | <!-- FIXME: When chunking, only the annotations actually used
|
---|
| 719 | in this chunk should be referenced. I don't think it
|
---|
| 720 | does any harm to reference them all, but it adds
|
---|
| 721 | unnecessary bloat to each chunk. -->
|
---|
| 722 | <xsl:if test="$annotation.support != 0 and //annotation">
|
---|
| 723 | <div class="annotation-list">
|
---|
| 724 | <div class="annotation-nocss">
|
---|
| 725 | <p>The following annotations are from this essay. You are seeing
|
---|
| 726 | them here because your browser doesn’t support the user-interface
|
---|
| 727 | techniques used to make them appear as ‘popups’ on modern browsers.</p>
|
---|
| 728 | </div>
|
---|
| 729 |
|
---|
| 730 | <xsl:apply-templates select="//annotation" mode="annotation-popup"/>
|
---|
| 731 | </div>
|
---|
| 732 | </xsl:if>
|
---|
| 733 | </xsl:template>
|
---|
| 734 |
|
---|
| 735 | <xsl:template name="process.chunk.footnotes">
|
---|
| 736 | <xsl:variable name="is.chunk">
|
---|
| 737 | <xsl:call-template name="chunk"/>
|
---|
| 738 | </xsl:variable>
|
---|
| 739 | <xsl:if test="$is.chunk = 1">
|
---|
| 740 | <xsl:call-template name="process.footnotes"/>
|
---|
| 741 | </xsl:if>
|
---|
| 742 | </xsl:template>
|
---|
| 743 |
|
---|
| 744 | <!-- ====================================================================== -->
|
---|
| 745 |
|
---|
| 746 | <!-- Resolve xml:base attributes -->
|
---|
| 747 | <xsl:template match="@fileref">
|
---|
| 748 | <!-- need a check for absolute urls -->
|
---|
| 749 | <xsl:choose>
|
---|
| 750 | <xsl:when test="contains(., ':')">
|
---|
| 751 | <!-- it has a uri scheme so it is an absolute uri -->
|
---|
| 752 | <xsl:value-of select="."/>
|
---|
| 753 | </xsl:when>
|
---|
| 754 | <xsl:otherwise>
|
---|
| 755 | <!-- its a relative uri -->
|
---|
| 756 | <xsl:call-template name="relative-uri">
|
---|
| 757 | <xsl:with-param name="destdir">
|
---|
| 758 | <xsl:call-template name="dbhtml-dir">
|
---|
| 759 | <xsl:with-param name="context" select=".."/>
|
---|
| 760 | </xsl:call-template>
|
---|
| 761 | </xsl:with-param>
|
---|
| 762 | </xsl:call-template>
|
---|
| 763 | </xsl:otherwise>
|
---|
| 764 | </xsl:choose>
|
---|
| 765 | </xsl:template>
|
---|
| 766 |
|
---|
| 767 | </xsl:stylesheet>
|
---|