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