| 1 |
<?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns:saxon="http://icl.com/saxon" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:redirect="http://xml.apache.org/xalan/redirect" xmlns:exsl="http://exslt.org/common" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="saxon lxslt redirect exsl doc d" extension-element-prefixes="saxon redirect lxslt exsl"> |
| 2 |
|
| 3 |
<!-- ******************************************************************** |
| 4 |
|
| 5 |
This file is part of the XSL DocBook Stylesheet distribution. |
| 6 |
See ../README or http://cdn.docbook.org/release/xsl/current/ for |
| 7 |
copyright and other information. |
| 8 |
|
| 9 |
******************************************************************** --> |
| 10 |
|
| 11 |
<!-- ==================================================================== --> |
| 12 |
|
| 13 |
<!-- This stylesheet works with XSLT implementations that support --> |
| 14 |
<!-- exsl:document, saxon:output, or Xalan's redirect:write --> |
| 15 |
<!-- Note: Only Saxon 6.4.2 or later is supported. --> |
| 16 |
|
| 17 |
<xsl:param name="chunker.output.method" select="'xml'"/> |
| 18 |
<xsl:param name="chunker.output.encoding" select="'UTF-8'"/> |
| 19 |
<xsl:param name="chunker.output.indent" select="'no'"/> |
| 20 |
<xsl:param name="chunker.output.omit-xml-declaration" select="'no'"/> |
| 21 |
<xsl:param name="chunker.output.standalone" select="'no'"/> |
| 22 |
<xsl:param name="chunker.output.doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/> |
| 23 |
<xsl:param name="chunker.output.doctype-system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'"/> |
| 24 |
<xsl:param name="chunker.output.media-type" select="''"/> |
| 25 |
<xsl:param name="chunker.output.cdata-section-elements" select="''"/> |
| 26 |
|
| 27 |
<!-- Make sure base.dir has a trailing slash. --> |
| 28 |
<!-- This is an internal-only variable. Customize $base.dir instead. --> |
| 29 |
<xsl:variable name="chunk.base.dir"> |
| 30 |
<xsl:choose> |
| 31 |
<xsl:when test="string-length($base.dir) = 0"/> |
| 32 |
<!-- make sure to add trailing slash if omitted by user --> |
| 33 |
<xsl:when test="substring($base.dir, string-length($base.dir), 1) = '/'"> |
| 34 |
<xsl:value-of select="$base.dir"/> |
| 35 |
</xsl:when> |
| 36 |
<xsl:otherwise> |
| 37 |
<xsl:value-of select="concat($base.dir, '/')"/> |
| 38 |
</xsl:otherwise> |
| 39 |
</xsl:choose> |
| 40 |
</xsl:variable> |
| 41 |
|
| 42 |
<xsl:param name="saxon.character.representation" select="'entity;decimal'"/> |
| 43 |
|
| 44 |
<!-- ==================================================================== --> |
| 45 |
|
| 46 |
<xsl:template name="make-relative-filename"> |
| 47 |
<xsl:param name="base.dir" select="'./'"/> |
| 48 |
<xsl:param name="base.name" select="''"/> |
| 49 |
|
| 50 |
<xsl:choose> |
| 51 |
<!-- put Saxon first to work around a bug in libxslt --> |
| 52 |
<xsl:when test="element-available('saxon:output')"> |
| 53 |
<!-- Saxon doesn't make the chunks relative --> |
| 54 |
<xsl:value-of select="concat($base.dir,$base.name)"/> |
| 55 |
</xsl:when> |
| 56 |
<xsl:when test="element-available('exsl:document')"> |
| 57 |
<!-- EXSL document does make the chunks relative, I think --> |
| 58 |
<xsl:choose> |
| 59 |
<xsl:when test="count(parent::*) = 0"> |
| 60 |
<xsl:value-of select="concat($base.dir,$base.name)"/> |
| 61 |
</xsl:when> |
| 62 |
<xsl:otherwise> |
| 63 |
<xsl:value-of select="$base.name"/> |
| 64 |
</xsl:otherwise> |
| 65 |
</xsl:choose> |
| 66 |
</xsl:when> |
| 67 |
<xsl:when test="element-available('redirect:write')"> |
| 68 |
<!-- Xalan doesn't make the chunks relative --> |
| 69 |
<xsl:value-of select="concat($base.dir,$base.name)"/> |
| 70 |
</xsl:when> |
| 71 |
<xsl:otherwise> |
| 72 |
<xsl:message terminate="yes"> |
| 73 |
<xsl:text>Don't know how to chunk with </xsl:text> |
| 74 |
<xsl:value-of select="system-property('xsl:vendor')"/> |
| 75 |
</xsl:message> |
| 76 |
</xsl:otherwise> |
| 77 |
</xsl:choose> |
| 78 |
</xsl:template> |
| 79 |
|
| 80 |
<xsl:template name="write.chunk"> |
| 81 |
<xsl:param name="filename" select="''"/> |
| 82 |
<xsl:param name="quiet" select="$chunk.quietly"/> |
| 83 |
<xsl:param name="suppress-context-node-name" select="0"/> |
| 84 |
<xsl:param name="message-prolog"/> |
| 85 |
<xsl:param name="message-epilog"/> |
| 86 |
|
| 87 |
<xsl:param name="method" select="$chunker.output.method"/> |
| 88 |
<xsl:param name="encoding" select="$chunker.output.encoding"/> |
| 89 |
<xsl:param name="indent" select="$chunker.output.indent"/> |
| 90 |
<xsl:param name="omit-xml-declaration" select="$chunker.output.omit-xml-declaration"/> |
| 91 |
<xsl:param name="standalone" select="$chunker.output.standalone"/> |
| 92 |
<xsl:param name="doctype-public" select="$chunker.output.doctype-public"/> |
| 93 |
<xsl:param name="doctype-system" select="$chunker.output.doctype-system"/> |
| 94 |
<xsl:param name="media-type" select="$chunker.output.media-type"/> |
| 95 |
<xsl:param name="cdata-section-elements" select="$chunker.output.cdata-section-elements"/> |
| 96 |
|
| 97 |
<xsl:param name="content"/> |
| 98 |
|
| 99 |
<xsl:if test="$quiet = 0"> |
| 100 |
<xsl:message> |
| 101 |
<xsl:if test="not($message-prolog = '')"> |
| 102 |
<xsl:value-of select="$message-prolog"/> |
| 103 |
</xsl:if> |
| 104 |
<xsl:text>Writing </xsl:text> |
| 105 |
<xsl:value-of select="$filename"/> |
| 106 |
<xsl:if test="name(.) != '' and $suppress-context-node-name = 0"> |
| 107 |
<xsl:text> for </xsl:text> |
| 108 |
<xsl:value-of select="name(.)"/> |
| 109 |
<xsl:if test="@id or @xml:id"> |
| 110 |
<xsl:text>(</xsl:text> |
| 111 |
<xsl:value-of select="(@id|@xml:id)[1]"/> |
| 112 |
<xsl:text>)</xsl:text> |
| 113 |
</xsl:if> |
| 114 |
</xsl:if> |
| 115 |
<xsl:if test="not($message-epilog = '')"> |
| 116 |
<xsl:value-of select="$message-epilog"/> |
| 117 |
</xsl:if> |
| 118 |
</xsl:message> |
| 119 |
</xsl:if> |
| 120 |
|
| 121 |
<xsl:choose> |
| 122 |
<xsl:when test="element-available('exsl:document')"> |
| 123 |
<xsl:choose> |
| 124 |
<!-- Handle the permutations ... --> |
| 125 |
<xsl:when test="$media-type != ''"> |
| 126 |
<xsl:choose> |
| 127 |
<xsl:when test="$doctype-public != '' and $doctype-system != ''"> |
| 128 |
<exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}"> |
| 129 |
<xsl:copy-of select="$content"/> |
| 130 |
</exsl:document> |
| 131 |
</xsl:when> |
| 132 |
<xsl:when test="$doctype-public != '' and $doctype-system = ''"> |
| 133 |
<exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" standalone="{$standalone}"> |
| 134 |
<xsl:copy-of select="$content"/> |
| 135 |
</exsl:document> |
| 136 |
</xsl:when> |
| 137 |
<xsl:when test="$doctype-public = '' and $doctype-system != ''"> |
| 138 |
<exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-system="{$doctype-system}" standalone="{$standalone}"> |
| 139 |
<xsl:copy-of select="$content"/> |
| 140 |
</exsl:document> |
| 141 |
</xsl:when> |
| 142 |
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> --> |
| 143 |
<exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" standalone="{$standalone}"> |
| 144 |
<xsl:copy-of select="$content"/> |
| 145 |
</exsl:document> |
| 146 |
</xsl:otherwise> |
| 147 |
</xsl:choose> |
| 148 |
</xsl:when> |
| 149 |
<xsl:otherwise> |
| 150 |
<xsl:choose> |
| 151 |
<xsl:when test="$doctype-public != '' and $doctype-system != ''"> |
| 152 |
<exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}"> |
| 153 |
<xsl:copy-of select="$content"/> |
| 154 |
</exsl:document> |
| 155 |
</xsl:when> |
| 156 |
<xsl:when test="$doctype-public != '' and $doctype-system = ''"> |
| 157 |
<exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" standalone="{$standalone}"> |
| 158 |
<xsl:copy-of select="$content"/> |
| 159 |
</exsl:document> |
| 160 |
</xsl:when> |
| 161 |
<xsl:when test="$doctype-public = '' and $doctype-system != ''"> |
| 162 |
<exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-system="{$doctype-system}" standalone="{$standalone}"> |
| 163 |
<xsl:copy-of select="$content"/> |
| 164 |
</exsl:document> |
| 165 |
</xsl:when> |
| 166 |
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> --> |
| 167 |
<exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" standalone="{$standalone}"> |
| 168 |
<xsl:copy-of select="$content"/> |
| 169 |
</exsl:document> |
| 170 |
</xsl:otherwise> |
| 171 |
</xsl:choose> |
| 172 |
</xsl:otherwise> |
| 173 |
</xsl:choose> |
| 174 |
</xsl:when> |
| 175 |
|
| 176 |
<xsl:when test="element-available('saxon:output')"> |
| 177 |
<xsl:choose> |
| 178 |
<!-- Handle the permutations ... --> |
| 179 |
<xsl:when test="$media-type != ''"> |
| 180 |
<xsl:choose> |
| 181 |
<xsl:when test="$doctype-public != '' and $doctype-system != ''"> |
| 182 |
<saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}"> |
| 183 |
<xsl:copy-of select="$content"/> |
| 184 |
</saxon:output> |
| 185 |
</xsl:when> |
| 186 |
<xsl:when test="$doctype-public != '' and $doctype-system = ''"> |
| 187 |
<saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" standalone="{$standalone}"> |
| 188 |
<xsl:copy-of select="$content"/> |
| 189 |
</saxon:output> |
| 190 |
</xsl:when> |
| 191 |
<xsl:when test="$doctype-public = '' and $doctype-system != ''"> |
| 192 |
<saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-system="{$doctype-system}" standalone="{$standalone}"> |
| 193 |
<xsl:copy-of select="$content"/> |
| 194 |
</saxon:output> |
| 195 |
</xsl:when> |
| 196 |
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> --> |
| 197 |
<saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" standalone="{$standalone}"> |
| 198 |
<xsl:copy-of select="$content"/> |
| 199 |
</saxon:output> |
| 200 |
</xsl:otherwise> |
| 201 |
</xsl:choose> |
| 202 |
</xsl:when> |
| 203 |
<xsl:otherwise> |
| 204 |
<xsl:choose> |
| 205 |
<xsl:when test="$doctype-public != '' and $doctype-system != ''"> |
| 206 |
<saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}"> |
| 207 |
<xsl:copy-of select="$content"/> |
| 208 |
</saxon:output> |
| 209 |
</xsl:when> |
| 210 |
<xsl:when test="$doctype-public != '' and $doctype-system = ''"> |
| 211 |
<saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" standalone="{$standalone}"> |
| 212 |
<xsl:copy-of select="$content"/> |
| 213 |
</saxon:output> |
| 214 |
</xsl:when> |
| 215 |
<xsl:when test="$doctype-public = '' and $doctype-system != ''"> |
| 216 |
<saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-system="{$doctype-system}" standalone="{$standalone}"> |
| 217 |
<xsl:copy-of select="$content"/> |
| 218 |
</saxon:output> |
| 219 |
</xsl:when> |
| 220 |
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> --> |
| 221 |
<saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" standalone="{$standalone}"> |
| 222 |
<xsl:copy-of select="$content"/> |
| 223 |
</saxon:output> |
| 224 |
</xsl:otherwise> |
| 225 |
</xsl:choose> |
| 226 |
</xsl:otherwise> |
| 227 |
</xsl:choose> |
| 228 |
</xsl:when> |
| 229 |
|
| 230 |
<xsl:when test="element-available('redirect:write')"> |
| 231 |
<!-- Xalan uses redirect --> |
| 232 |
<redirect:write file="{$filename}"> |
| 233 |
<xsl:copy-of select="$content"/> |
| 234 |
</redirect:write> |
| 235 |
</xsl:when> |
| 236 |
|
| 237 |
<xsl:otherwise> |
| 238 |
<!-- it doesn't matter since we won't be making chunks... --> |
| 239 |
<xsl:message terminate="yes"> |
| 240 |
<xsl:text>Can't make chunks with </xsl:text> |
| 241 |
<xsl:value-of select="system-property('xsl:vendor')"/> |
| 242 |
<xsl:text>'s processor.</xsl:text> |
| 243 |
</xsl:message> |
| 244 |
</xsl:otherwise> |
| 245 |
</xsl:choose> |
| 246 |
</xsl:template> |
| 247 |
|
| 248 |
<xsl:template name="write.chunk.with.doctype"> |
| 249 |
<xsl:param name="filename" select="''"/> |
| 250 |
<xsl:param name="quiet" select="$chunk.quietly"/> |
| 251 |
|
| 252 |
<xsl:param name="method" select="$chunker.output.method"/> |
| 253 |
<xsl:param name="encoding" select="$chunker.output.encoding"/> |
| 254 |
<xsl:param name="indent" select="$chunker.output.indent"/> |
| 255 |
<xsl:param name="omit-xml-declaration" select="$chunker.output.omit-xml-declaration"/> |
| 256 |
<xsl:param name="standalone" select="$chunker.output.standalone"/> |
| 257 |
<xsl:param name="doctype-public" select="$chunker.output.doctype-public"/> |
| 258 |
<xsl:param name="doctype-system" select="$chunker.output.doctype-system"/> |
| 259 |
<xsl:param name="media-type" select="$chunker.output.media-type"/> |
| 260 |
<xsl:param name="cdata-section-elements" select="$chunker.output.cdata-section-elements"/> |
| 261 |
|
| 262 |
<xsl:param name="content"/> |
| 263 |
|
| 264 |
<xsl:call-template name="write.chunk"> |
| 265 |
<xsl:with-param name="filename" select="$filename"/> |
| 266 |
<xsl:with-param name="quiet" select="$quiet"/> |
| 267 |
<xsl:with-param name="method" select="$method"/> |
| 268 |
<xsl:with-param name="encoding" select="$encoding"/> |
| 269 |
<xsl:with-param name="indent" select="$indent"/> |
| 270 |
<xsl:with-param name="omit-xml-declaration" select="$omit-xml-declaration"/> |
| 271 |
<xsl:with-param name="standalone" select="$standalone"/> |
| 272 |
<xsl:with-param name="doctype-public" select="$doctype-public"/> |
| 273 |
<xsl:with-param name="doctype-system" select="$doctype-system"/> |
| 274 |
<xsl:with-param name="media-type" select="$media-type"/> |
| 275 |
<xsl:with-param name="cdata-section-elements" select="$cdata-section-elements"/> |
| 276 |
<xsl:with-param name="content" select="$content"/> |
| 277 |
</xsl:call-template> |
| 278 |
</xsl:template> |
| 279 |
|
| 280 |
<xsl:template name="write.text.chunk"> |
| 281 |
<xsl:param name="filename" select="''"/> |
| 282 |
<xsl:param name="quiet" select="$chunk.quietly"/> |
| 283 |
<xsl:param name="suppress-context-node-name" select="0"/> |
| 284 |
<xsl:param name="message-prolog"/> |
| 285 |
<xsl:param name="message-epilog"/> |
| 286 |
<xsl:param name="method" select="'text'"/> |
| 287 |
<xsl:param name="encoding" select="$chunker.output.encoding"/> |
| 288 |
<xsl:param name="media-type" select="$chunker.output.media-type"/> |
| 289 |
<xsl:param name="content"/> |
| 290 |
|
| 291 |
<xsl:call-template name="write.chunk"> |
| 292 |
<xsl:with-param name="filename" select="$filename"/> |
| 293 |
<xsl:with-param name="quiet" select="$quiet"/> |
| 294 |
<xsl:with-param name="suppress-context-node-name" select="$suppress-context-node-name"/> |
| 295 |
<xsl:with-param name="message-prolog" select="$message-prolog"/> |
| 296 |
<xsl:with-param name="message-epilog" select="$message-epilog"/> |
| 297 |
<xsl:with-param name="method" select="$method"/> |
| 298 |
<xsl:with-param name="encoding" select="$encoding"/> |
| 299 |
<xsl:with-param name="indent" select="'no'"/> |
| 300 |
<xsl:with-param name="omit-xml-declaration" select="'yes'"/> |
| 301 |
<xsl:with-param name="standalone" select="'no'"/> |
| 302 |
<xsl:with-param name="doctype-public"/> |
| 303 |
<xsl:with-param name="doctype-system"/> |
| 304 |
<xsl:with-param name="media-type" select="$media-type"/> |
| 305 |
<xsl:with-param name="cdata-section-elements"/> |
| 306 |
<xsl:with-param name="content" select="$content"/> |
| 307 |
</xsl:call-template> |
| 308 |
</xsl:template> |
| 309 |
|
| 310 |
|
| 311 |
</xsl:stylesheet> |