]> Lady’s Gitweb - Shushe/blob - lib/catalog2transform.xslt
Use <书社:apply-attributes-to-root> to add version
[Shushe] / lib / catalog2transform.xslt
1 <?xml version="1.0"?>
2 <!--
3 SPDX-FileCopyrightText: 2023, 2024 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
5 -->
6 <!--
7 ⁌ ⛩📰 书社 ∷ lib/catalog2transform.xslt
8
9 © 2023–2024 Lady [@ Ladys Computer].
10
11 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
12 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
13 -->
14 <!DOCTYPE transform [
15 <!ENTITY 书社 "urn:fdc:ladys.computer:20231231:Shu1She4">
16 <!ENTITY xml "http://www.w3.org/XML/1998/namespace">
17 ]>
18 <transform
19 xmlns="http://www.w3.org/1999/XSL/Transform"
20 xmlns:catalog="urn:oasis:names:tc:entity:xmlns:xml:catalog"
21 xmlns:exsl="http://exslt.org/common"
22 xmlns:exslfunc="http://exslt.org/functions"
23 xmlns:exslstr="http://exslt.org/strings"
24 xmlns:html="http://www.w3.org/1999/xhtml"
25 xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#"
26 xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#"
27 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
28 xmlns:svg="http://www.w3.org/2000/svg"
29 xmlns:xlink="http://www.w3.org/1999/xlink"
30 xmlns:xslt="http://www.w3.org/1999/XSL/TransformAlias"
31 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
32 xmlns:书社vocab="urn:fdc:ladys.computer:20231231:Shu1She4:vocab:"
33 exclude-result-prefixes="catalog"
34 version="1.0"
35 >
36 <include href="literally.xslt"/>
37 <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
38 <param name="METADATA" select="'about:blank'"/>
39 <variable name="builddir" select="document($METADATA)//书社vocab:BuildDirectory/@nfo:fileUrl"/>
40 <template match="/">
41 <variable name="ids">
42 <for-each select="//catalog:uri[@name]">
43 <书社:id>
44 <value-of select="@name"/>
45 </书社:id>
46 </for-each>
47 </variable>
48 <variable name="unique-ids">
49 <for-each select="exsl:node-set($ids)/*">
50 <if test="not(preceding-sibling::*[string(.)=string(current())])">
51 <copy-of select="."/>
52 </if>
53 </for-each>
54 </variable>
55 <xslt:transform exclude-result-prefixes="nie nfo" extension-element-prefixes="exsl exslfunc exslstr" version="1.0">
56 <xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
57 <xslt:param name="IDENTIFIER" select="false()"/>
58 <xslt:param name="SRCREV" select="false()"/>
59 <xslt:param name="THISREV" select="false()"/>
60 <element name="exslfunc:function">
61 <attribute name="name">
62 <text>书社:document-with-attributes-applied</text>
63 </attribute>
64 <xslt:param name="document" select="/.."/>
65 <xslt:variable name="application-result-fragment">
66 <xslt:variable name="result-nodes" select="$document/node()[not(self::书社:apply-attributes-to-root)]|$document/书社:apply-attributes-to-root//node()[not(self::书社:apply-attributes-to-root) and not(ancestor::*[not(self::书社:apply-attributes-to-root)])]"/>
67 <xslt:variable name="root-with-attributes">
68 <xslt:call-template name="书社:apply-attributes">
69 <xslt:with-param name="context-nodes" select="$document//书社:apply-attributes-to-root"/>
70 <xslt:with-param name="destination-nodes" select="$result-nodes"/>
71 </xslt:call-template>
72 </xslt:variable>
73 <xslt:apply-templates select="exsl:node-set($root-with-attributes)" mode="书社:apply"/>
74 </xslt:variable>
75 <element name="exslfunc:result">
76 <attribute name="select">
77 <text>exsl:node-set($application-result-fragment)</text>
78 </attribute>
79 </element>
80 </element>
81 <xslt:variable name="书社:source" select="/"/>
82 <xslt:variable name="书社:about-fragment">
83 <apply-templates select="document($METADATA)" mode="书社:literally">
84 <with-param name="extension-element-namespaces" select="'http://exslt.org/common http://exslt.org/functions http://exslt.org/strings'"/>
85 </apply-templates>
86 </xslt:variable>
87 <xslt:variable name="书社:about" select="exsl:node-set($书社:about-fragment)"/>
88 <xslt:variable name="书社:expansion-fragment">
89 <xslt:apply-templates select="$书社:source/node()" mode="书社:expand"/>
90 </xslt:variable>
91 <xslt:variable name="书社:expansion" select="书社:document-with-attributes-applied(exsl:node-set($书社:expansion-fragment))"/>
92 <xslt:variable name="书社:result-fragment">
93 <xslt:element name="书社:apply-attributes-to-root">
94 <xslt:attribute name="书社:version">
95 <xslt:value-of select="$THISREV"/>
96 </xslt:attribute>
97 <xslt:apply-templates select="$书社:expansion/node()"/>
98 </xslt:element>
99 </xslt:variable>
100 <xslt:variable name="书社:result" select="书社:document-with-attributes-applied(exsl:node-set($书社:result-fragment))"/>
101 <xslt:variable name="书社:destination" select="string($书社:about//*[@rdf:about=$IDENTIFIER]/@书社vocab:destination)"/>
102 <for-each select="//catalog:uri">
103 <xslt:include href="{@uri}">
104 <attribute name="书社:id">
105 <value-of select="@name"/>
106 </attribute>
107 </xslt:include>
108 </for-each>
109 <xslt:template name="书社:apply-attributes">
110 <xslt:param name="context-nodes" select="/.."/>
111 <xslt:param name="destination-nodes" select="/.."/>
112 <xslt:variable name="additional-attributes" select="$context-nodes/@*"/>
113 <xslt:for-each select="$destination-nodes">
114 <xslt:variable name="existing-attributes" select="@*"/>
115 <xslt:choose>
116 <xslt:when test="self::*">
117 <xslt:variable name="context" select="."/>
118 <xslt:variable name="attribute-names">
119 <xslt:for-each select="$existing-attributes|$additional-attributes">
120 <书社:attribute>
121 <attribute name="local-name">
122 <text>{local-name()}</text>
123 </attribute>
124 <attribute name="name">
125 <text>{name()}</text>
126 </attribute>
127 <attribute name="namespace-uri">
128 <text>{namespace-uri()}</text>
129 </attribute>
130 </书社:attribute>
131 </xslt:for-each>
132 </xslt:variable>
133 <xslt:variable name="lang">
134 <xslt:choose>
135 <xslt:when test="(self::html:*|self::svg:*)/@lang">
136 <xslt:value-of select="@lang"/>
137 </xslt:when>
138 <xslt:when test="@xml:lang">
139 <xslt:value-of select="@xml:lang"/>
140 </xslt:when>
141 <xslt:when test="$additional-attributes[(parent::html:* or parent::svg:*) and namespace-uri()='' and local-name()='lang']">
142 <xslt:value-of select="$additional-attributes[(parent::html:* or parent::svg:*) and namespace-uri()='' and local-name()='lang']"/>
143 </xslt:when>
144 <xslt:when test="(self::html:* or self::svg:*) and $additional-attributes[(parent::书社:apply-attributes or parent::书社:apply-attributes-to-root) and namespace-uri()='' and local-name()='lang']">
145 <xslt:value-of select="$additional-attributes[(parent::书社:apply-attributes or parent::书社:apply-attributes-to-root) and namespace-uri()='' and local-name()='lang']"/>
146 </xslt:when>
147 <xslt:when test="$additional-attributes[namespace-uri()='&xml;' and local-name()='lang']">
148 <xslt:value-of select="$additional-attributes[namespace-uri()='&xml;' and local-name()='lang']"/>
149 </xslt:when>
150 </xslt:choose>
151 </xslt:variable>
152 <xslt:copy>
153 <xslt:if test="string($lang)!=''">
154 <xslt:if test="self::html:* or self::svg:*">
155 <xslt:attribute name="lang">
156 <xslt:value-of select="$lang"/>
157 </xslt:attribute>
158 </xslt:if>
159 <xslt:attribute name="xml:lang">
160 <xslt:value-of select="$lang"/>
161 </xslt:attribute>
162 </xslt:if>
163 <xslt:for-each select="exsl:node-set($attribute-names)/*">
164 <xslt:choose>
165 <xslt:when test="@namespace-uri='&xml;'"/>
166 <xslt:when test="$context[self::html:* or self::svg:*] and @namespace-uri='' and @local-name='lang'"/>
167 <xslt:when test="@namespace-uri='&书社;' and (@local-name='destination' or @local-name='disable-output-wrapping')"/>
168 <xslt:when test="preceding-sibling::*[@local-name=current()/@local-name and @namespace-uri=current()/@namespace-uri]"/>
169 <xslt:otherwise>
170 <xslt:attribute>
171 <attribute name="name">
172 <text>{@name}</text>
173 </attribute>
174 <attribute name="namespace">
175 <text>{@namespace-uri}</text>
176 </attribute>
177 <xslt:for-each select="$existing-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri]">
178 <xslt:value-of select="."/>
179 <xslt:if test="position()!=last()">
180 <xslt:text>
181 <text> </text>
182 </xslt:text>
183 </xslt:if>
184 </xslt:for-each>
185 <xslt:if test="$existing-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri] and $additional-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri]">
186 <xslt:text>
187 <text> </text>
188 </xslt:text>
189 </xslt:if>
190 <xslt:for-each select="$additional-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri]">
191 <xslt:value-of select="."/>
192 <xslt:if test="position()!=last()">
193 <xslt:text>
194 <text> </text>
195 </xslt:text>
196 </xslt:if>
197 </xslt:for-each>
198 </xslt:attribute>
199 </xslt:otherwise>
200 </xslt:choose>
201 </xslt:for-each>
202 <xslt:copy-of select="node()"/>
203 </xslt:copy>
204 </xslt:when>
205 <xslt:otherwise>
206 <xslt:copy-of select="."/>
207 </xslt:otherwise>
208 </xslt:choose>
209 </xslt:for-each>
210 </xslt:template>
211 <xslt:template name="书社:wrap">
212 <xslt:param name="nodes" select="/.."/>
213 <xslt:variable name="modalinput-fragment">
214 <xslt:copy-of select="$nodes"/>
215 <apply-templates select="exsl:node-set($unique-ids)" mode="书社:literally"/>
216 </xslt:variable>
217 <xslt:variable name="modalinput" select="exsl:node-set($modalinput-fragment)"/>
218 <xslt:variable name="metadata-fragment">
219 <xslt:copy-of select="$nodes[self::html:html]/html:head/node()|$nodes[self::html:head]/node()"/>
220 <xslt:apply-templates select="$modalinput/node()" mode="书社:metadata"/>
221 </xslt:variable>
222 <xslt:variable name="metadata" select="exsl:node-set($metadata-fragment)"/>
223 <html:html>
224 <xslt:copy-of select="$nodes[self::html:html]/@*"/>
225 <xslt:if test="not($nodes[self::html:html]/@书社:archived-as) and $nodes/@书社:archived-as">
226 <xslt:attribute name="书社:archived-as">
227 <xslt:value-of select="$nodes/@书社:archived-as"/>
228 </xslt:attribute>
229 </xslt:if>
230 <xslt:if test="not($nodes[self::html:html]/@lang) and $nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang">
231 <xslt:attribute name="lang">
232 <xslt:value-of select="$nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang"/>
233 </xslt:attribute>
234 </xslt:if>
235 <xslt:if test="not($nodes[self::html:html]/@xml:lang) and $nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang">
236 <xslt:attribute name="xml:lang">
237 <xslt:value-of select="$nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang"/>
238 </xslt:attribute>
239 </xslt:if>
240 <html:head>
241 <xslt:copy-of select="$nodes[self::html:html]/html:head/@*|$nodes[self::html:head]/@*"/>
242 <html:title>
243 <xslt:for-each select="$metadata/html:title">
244 <xslt:value-of select="."/>
245 <xslt:if test="position()!=last()">
246 <xslt:text>
247 <text> </text>
248 </xslt:text>
249 </xslt:if>
250 </xslt:for-each>
251 </html:title>
252 <xslt:copy-of select="$metadata/node()[not(self::html:title or self::html:meta and @name='generator')]"/>
253 <html:meta name="generator">
254 <xslt:attribute name="content">
255 <xslt:for-each select="$metadata/html:meta[@name='generator']">
256 <xslt:value-of select="@content"/>
257 <xslt:text>
258 <text>, </text>
259 </xslt:text>
260 </xslt:for-each>
261 <xslt:text>
262 <text>⛩📰 书社</text>
263 </xslt:text>
264 <xslt:if test="$THISREV">
265 <xslt:text>
266 <text> (</text>
267 </xslt:text>
268 <xslt:value-of select="$THISREV"/>
269 <xslt:text>
270 <text>)</text>
271 </xslt:text>
272 </xslt:if>
273 </xslt:attribute>
274 </html:meta>
275 </html:head>
276 <html:body>
277 <xslt:copy-of select="$nodes[self::html:html]/html:body/@*|$nodes[self::html:body]/@*"/>
278 <xslt:apply-templates select="$modalinput/node()" mode="书社:header"/>
279 <xslt:copy-of select="$nodes[not(self::html:html or self::html:head or self::html:body)]|$nodes[self::html:html]/node()[not(self::html:head or self::html:body)]|$nodes[self::html:html]/html:body/node()|$nodes[self::html:body]/node()"/>
280 <xslt:apply-templates select="$modalinput/node()" mode="书社:footer"/>
281 </html:body>
282 </html:html>
283 </xslt:template>
284 <xslt:template match="/">
285 <xslt:variable name="finalization-fragment">
286 <xslt:apply-templates select="$书社:result" mode="书社:finalize"/>
287 </xslt:variable>
288 <xslt:copy-of select="书社:document-with-attributes-applied(exsl:node-set($finalization-fragment))"/>
289 </xslt:template>
290 <xslt:template match="@*|node()" priority="-1">
291 <xslt:copy>
292 <xslt:apply-templates select="@*|node()"/>
293 </xslt:copy>
294 </xslt:template>
295 <xslt:template match="书社:apply-attributes" mode="书社:apply" priority="1">
296 <xslt:variable name="children">
297 <xslt:apply-templates mode="书社:apply"/>
298 </xslt:variable>
299 <xslt:call-template name="书社:apply-attributes">
300 <xslt:with-param name="context-nodes" select="."/>
301 <xslt:with-param name="destination-nodes" select="exsl:node-set($children)/node()"/>
302 </xslt:call-template>
303 </xslt:template>
304 <xslt:template match="书社:apply-attributes-to-root" mode="书社:apply" priority="1">
305 <xslt:apply-templates mode="书社:apply"/>
306 </xslt:template>
307 <xslt:template match="@*|node()" mode="书社:apply" priority="-1">
308 <xslt:copy>
309 <xslt:apply-templates select="@*|node()" mode="书社:apply"/>
310 </xslt:copy>
311 </xslt:template>
312 <xslt:template match="书社:link[@xlink:show='embed' and (not(@xlink:actuate) or @xlink:actuate='none')]" mode="书社:expand" priority="1">
313 <xslt:variable name="link" select="."/>
314 <xslt:variable name="identifier" select="string(@xlink:href)"/>
315 <xslt:variable name="is-dir" select="substring($identifier, string-length($identifier))='/'"/>
316 <xslt:variable name="included" select="$书社:about//*[@rdf:about=$identifier or $is-dir and starts-with(@rdf:about, $identifier)]"/>
317 <xslt:choose>
318 <xslt:when test="$included">
319 <xslt:for-each select="$included">
320 <xslt:sort select="@rdf:about" data-type="text" lang="zxx" case-order="upper-first"/>
321 <xslt:variable name="uri" select="书社vocab:hasParsedFile/@nfo:fileUrl"/>
322 <xslt:variable name="expanded">
323 <xslt:apply-templates select="document($uri)" mode="书社:expand">
324 <xslt:with-param name="identifier" select="string(@rdf:about)"/>
325 </xslt:apply-templates>
326 </xslt:variable>
327 <xslt:for-each select="exsl:node-set($expanded)/node()">
328 <xslt:copy>
329 <xslt:choose>
330 <xslt:when test="self::html:*">
331 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
332 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
333 <xslt:attribute name="itemtype">
334 <xslt:for-each select="$existing-types/token[string()!='&书社;:document']">
335 <xslt:if test="position()!=1">
336 <xslt:text>
337 <text> </text>
338 </xslt:text>
339 </xslt:if>
340 <xslt:value-of select="."/>
341 </xslt:for-each>
342 <xslt:if test="not($existing-types/token[string()='&书社;:embed'])">
343 <xslt:if test="$existing-types/token[string()!='&书社;:document']">
344 <xslt:text>
345 <text> </text>
346 </xslt:text>
347 </xslt:if>
348 <xslt:text>
349 <text>&书社;:embed</text>
350 </xslt:text>
351 </xslt:if>
352 </xslt:attribute>
353 <xslt:choose>
354 <xslt:when test="$link/@书社:archived-as">
355 <xslt:copy-of select="$link/@书社:archived-as"/>
356 </xslt:when>
357 <xslt:when test="@书社:archived-as">
358 <xslt:copy-of select="@书社:archived-as"/>
359 </xslt:when>
360 </xslt:choose>
361 <xslt:copy-of select="@*[not(namespace-uri()='' and (local-name()='itemscope' or local-name()='itemtype')) and not(namespace-uri()='&书社;' and local-name()='archived-as')]|node()"/>
362 </xslt:when>
363 <xslt:otherwise>
364 <xslt:choose>
365 <xslt:when test="self::* and $link/@书社:archived-as">
366 <xslt:copy-of select="$link/@书社:archived-as"/>
367 </xslt:when>
368 <xslt:when test="@书社:archived-as">
369 <xslt:copy-of select="@书社:archived-as"/>
370 </xslt:when>
371 </xslt:choose>
372 <xslt:copy-of select="@*[not(namespace-uri()='&书社;' and local-name()='archived-as')]|node()"/>
373 </xslt:otherwise>
374 </xslt:choose>
375 </xslt:copy>
376 </xslt:for-each>
377 </xslt:for-each>
378 </xslt:when>
379 <xslt:otherwise>
380 <xslt:copy>
381 <xslt:apply-templates select="@*|node()" mode="书社:expand"/>
382 </xslt:copy>
383 </xslt:otherwise>
384 </xslt:choose>
385 </xslt:template>
386 <xslt:template match="/node()" mode="书社:expand" priority="0">
387 <xslt:param name="identifier" select="$IDENTIFIER"/>
388 <xslt:copy>
389 <xslt:if test="self::*">
390 <xslt:attribute name="书社:cksum">
391 <xslt:value-of select="$书社:about//*[@rdf:about=$identifier]/nfo:hasHash[@nfo:hashAlgorithm='CRC32']/@nfo:hashValue"/>
392 </xslt:attribute>
393 <xslt:attribute name="书社:identifier">
394 <xslt:value-of select="$identifier"/>
395 </xslt:attribute>
396 <xslt:attribute name="书社:mtime">
397 <xslt:value-of select="$书社:about//*[@rdf:about=$identifier]/nfo:fileLastModified"/>
398 </xslt:attribute>
399 </xslt:if>
400 <xslt:choose>
401 <xslt:when test="self::html:*">
402 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
403 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
404 <xslt:attribute name="itemtype">
405 <xslt:for-each select="$existing-types/token">
406 <xslt:if test="position()!=1">
407 <xslt:text>
408 <text> </text>
409 </xslt:text>
410 </xslt:if>
411 <xslt:value-of select="."/>
412 </xslt:for-each>
413 <xslt:if test="not($existing-types/token[string()='&书社;:embed' or string()='&书社;:document'])">
414 <xslt:if test="$existing-types/token">
415 <xslt:text>
416 <text> </text>
417 </xslt:text>
418 </xslt:if>
419 <xslt:text>
420 <text>&书社;:document</text>
421 </xslt:text>
422 </xslt:if>
423 </xslt:attribute>
424 <xslt:apply-templates select="@*[not(namespace-uri()='' and (local-name()='itemscope' or local-name()='itemtype') or namespace-uri()='&书社;' and (local-name()='cksum' or local-name()='identifier' or local-name()='mtime'))]|node()" mode="书社:expand"/>
425 </xslt:when>
426 <xslt:otherwise>
427 <xslt:apply-templates select="@*[not(namespace-uri()='&书社;' and (local-name()='cksum' or local-name()='identifier' or local-name()='mtime'))]|node()" mode="书社:expand"/>
428 </xslt:otherwise>
429 </xslt:choose>
430 </xslt:copy>
431 </xslt:template>
432 <xslt:template match="@*|node()" mode="书社:expand" priority="-1">
433 <xslt:copy>
434 <xslt:apply-templates select="@*|node()" mode="书社:expand"/>
435 </xslt:copy>
436 </xslt:template>
437 <xslt:template match="text()" mode="书社:header"/>
438 <xslt:template match="书社:archive" mode="书社:finalize" priority="1">
439 <xslt:copy>
440 <xslt:apply-templates select="@*" mode="书社:finalize"/>
441 <xslt:for-each select="node()">
442 <xslt:choose>
443 <xslt:when test="self::*">
444 <xslt:variable name="component-fragment">
445 <xslt:copy>
446 <xslt:choose>
447 <xslt:when test="self::html:*">
448 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
449 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
450 <xslt:attribute name="itemtype">
451 <xslt:for-each select="$existing-types/token">
452 <xslt:if test="position()!=1">
453 <xslt:text>
454 <text> </text>
455 </xslt:text>
456 </xslt:if>
457 <xslt:value-of select="."/>
458 </xslt:for-each>
459 <xslt:if test="not($existing-types/token[string()='&书社;:embed' or string()='&书社;:document'])">
460 <xslt:if test="$existing-types/token">
461 <xslt:text>
462 <text> </text>
463 </xslt:text>
464 </xslt:if>
465 <xslt:text>
466 <text>&书社;:document</text>
467 </xslt:text>
468 </xslt:if>
469 </xslt:attribute>
470 <xslt:copy-of select="@*[not(namespace-uri()='' and (local-name()='itemscope' or local-name()='itemtype'))]|node()"/>
471 </xslt:when>
472 <xslt:otherwise>
473 <xslt:copy-of select="@*|node()"/>
474 </xslt:otherwise>
475 </xslt:choose>
476 </xslt:copy>
477 </xslt:variable>
478 <xslt:variable name="finalization-fragment">
479 <xslt:apply-templates select="exsl:node-set($component-fragment)" mode="书社:finalize"/>
480 </xslt:variable>
481 <xslt:copy-of select="书社:document-with-attributes-applied(exsl:node-set($finalization-fragment))"/>
482 </xslt:when>
483 <xslt:otherwise>
484 <xslt:apply-templates select="." mode="书社:finalize"/>
485 </xslt:otherwise>
486 </xslt:choose>
487 </xslt:for-each>
488 </xslt:copy>
489 </xslt:template>
490 <xslt:template match="@书社:destination|@书社:disable-output-wrapping" mode="书社:finalize" priority="1"/>
491 <xslt:template match="/" mode="书社:finalize">
492 <xslt:choose>
493 <xslt:when test="not(html:*) or 书社:raw-text or 书社:base64-binary or 书社:archive or */@书社:disable-output-wrapping">
494 <xslt:apply-templates mode="书社:finalize"/>
495 </xslt:when>
496 <xslt:otherwise>
497 <xslt:variable name="wrapped-result">
498 <xslt:call-template name="书社:wrap">
499 <xslt:with-param name="nodes" select="node()"/>
500 </xslt:call-template>
501 </xslt:variable>
502 <xslt:apply-templates select="exsl:node-set($wrapped-result)/node()" mode="书社:finalize"/>
503 </xslt:otherwise>
504 </xslt:choose>
505 </xslt:template>
506 <xslt:template match="@*|node()" mode="书社:finalize" priority="-1">
507 <xslt:copy>
508 <xslt:apply-templates select="@*|node()" mode="书社:finalize"/>
509 </xslt:copy>
510 </xslt:template>
511 <xslt:template match="text()" mode="书社:footer"/>
512 <xslt:template match="text()" mode="书社:metadata"/>
513 <xslt:output method="xml" encoding="UTF-8" cdata-section-elements="html:script html:style html:textarea 书社:raw-output 书社:raw-text"/>
514 </xslt:transform>
515 </template>
516 <output method="xml" encoding="UTF-8"/>
517 </transform>
This page took 0.089643 seconds and 5 git commands to generate.