]> Lady’s Gitweb - Shushe/blob - lib/catalog2transform.xslt
68fb3a2b55c25f7aaa1368f7d5d8929fe5ddfe7f
[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:param name="and-version" select="false()"/>
66 <xslt:variable name="application-result-fragment">
67 <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)])]"/>
68 <xslt:variable name="significant-nodes" select="$result-nodes/descendant-or-self::*[not(self::书社:apply-attributes) and not(ancestor::*[not(self::书社:apply-attributes)])]"/>
69 <xslt:variable name="root-with-attributes">
70 <xslt:call-template name="书社:apply-attributes">
71 <xslt:with-param name="and-version" select="$and-version"/>
72 <xslt:with-param name="context-nodes" select="$document//书社:apply-attributes-to-root"/>
73 <xslt:with-param name="destination-nodes" select="$result-nodes"/>
74 </xslt:call-template>
75 </xslt:variable>
76 <xslt:apply-templates select="exsl:node-set($root-with-attributes)" mode="书社:apply"/>
77 </xslt:variable>
78 <element name="exslfunc:result">
79 <attribute name="select">
80 <text>exsl:node-set($application-result-fragment)</text>
81 </attribute>
82 </element>
83 </element>
84 <xslt:variable name="书社:source" select="/"/>
85 <xslt:variable name="书社:about-fragment">
86 <apply-templates select="document($METADATA)" mode="书社:literally">
87 <with-param name="extension-element-namespaces" select="'http://exslt.org/common http://exslt.org/functions http://exslt.org/strings'"/>
88 </apply-templates>
89 </xslt:variable>
90 <xslt:variable name="书社:about" select="exsl:node-set($书社:about-fragment)"/>
91 <xslt:variable name="书社:expansion-fragment">
92 <xslt:apply-templates select="$书社:source/node()" mode="书社:expand"/>
93 </xslt:variable>
94 <xslt:variable name="书社:expansion" select="书社:document-with-attributes-applied(exsl:node-set($书社:expansion-fragment))"/>
95 <xslt:variable name="书社:result-fragment">
96 <xslt:apply-templates select="$书社:expansion/node()"/>
97 </xslt:variable>
98 <xslt:variable name="书社:result" select="书社:document-with-attributes-applied(exsl:node-set($书社:result-fragment))"/>
99 <xslt:variable name="书社:destination" select="string($书社:about//*[@rdf:about=$IDENTIFIER]/@书社vocab:destination)"/>
100 <for-each select="//catalog:uri">
101 <xslt:include href="{@uri}">
102 <attribute name="书社:id">
103 <value-of select="@name"/>
104 </attribute>
105 </xslt:include>
106 </for-each>
107 <xslt:template name="书社:apply-attributes">
108 <xslt:param name="and-version" select="false()"/>
109 <xslt:param name="context-nodes" select="/.."/>
110 <xslt:param name="destination-nodes" select="/.."/>
111 <xslt:variable name="additional-attributes" select="$context-nodes/@*"/>
112 <xslt:for-each select="$destination-nodes">
113 <xslt:variable name="existing-attributes" select="@*"/>
114 <xslt:choose>
115 <xslt:when test="self::*">
116 <xslt:variable name="context" select="."/>
117 <xslt:variable name="attribute-names">
118 <xslt:for-each select="$existing-attributes|$additional-attributes">
119 <书社:attribute>
120 <attribute name="local-name">
121 <text>{local-name()}</text>
122 </attribute>
123 <attribute name="name">
124 <text>{name()}</text>
125 </attribute>
126 <attribute name="namespace-uri">
127 <text>{namespace-uri()}</text>
128 </attribute>
129 </书社:attribute>
130 </xslt:for-each>
131 </xslt:variable>
132 <xslt:variable name="lang">
133 <xslt:choose>
134 <xslt:when test="(self::html:*|self::svg:*)/@lang">
135 <xslt:value-of select="@lang"/>
136 </xslt:when>
137 <xslt:when test="@xml:lang">
138 <xslt:value-of select="@xml:lang"/>
139 </xslt:when>
140 <xslt:when test="$additional-attributes[(parent::html:* or parent::svg:*) and namespace-uri()='' and local-name()='lang']">
141 <xslt:value-of select="$additional-attributes[(parent::html:* or parent::svg:*) and namespace-uri()='' and local-name()='lang']"/>
142 </xslt:when>
143 <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']">
144 <xslt:value-of select="$additional-attributes[(parent::书社:apply-attributes or parent::书社:apply-attributes-to-root) and namespace-uri()='' and local-name()='lang']"/>
145 </xslt:when>
146 <xslt:when test="$additional-attributes[namespace-uri()='&xml;' and local-name()='lang']">
147 <xslt:value-of select="$additional-attributes[namespace-uri()='&xml;' and local-name()='lang']"/>
148 </xslt:when>
149 </xslt:choose>
150 </xslt:variable>
151 <xslt:copy>
152 <xslt:if test="$and-version and $THISREV">
153 <xslt:attribute name="书社:version">
154 <xslt:value-of select="$THISREV"/>
155 </xslt:attribute>
156 </xslt:if>
157 <xslt:if test="string($lang)!=''">
158 <xslt:if test="self::html:* or self::svg:*">
159 <xslt:attribute name="lang">
160 <xslt:value-of select="$lang"/>
161 </xslt:attribute>
162 </xslt:if>
163 <xslt:attribute name="xml:lang">
164 <xslt:value-of select="$lang"/>
165 </xslt:attribute>
166 </xslt:if>
167 <xslt:for-each select="exsl:node-set($attribute-names)/*">
168 <xslt:choose>
169 <xslt:when test="@namespace-uri='&xml;'"/>
170 <xslt:when test="$context[self::html:* or self::svg:*] and @namespace-uri='' and @local-name='lang'"/>
171 <xslt:when test="$and-version and $THISREV and @namespace-uri='&书社;' and @local-name='version'"/>
172 <xslt:when test="@namespace-uri='&书社;' and (@local-name='destination' or @local-name='disable-output-wrapping')"/>
173 <xslt:when test="preceding-sibling::*[@local-name=current()/@local-name and @namespace-uri=current()/@namespace-uri]"/>
174 <xslt:otherwise>
175 <xslt:attribute>
176 <attribute name="name">
177 <text>{@name}</text>
178 </attribute>
179 <attribute name="namespace">
180 <text>{@namespace-uri}</text>
181 </attribute>
182 <xslt:for-each select="$existing-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri]">
183 <xslt:value-of select="."/>
184 <xslt:if test="position()!=last()">
185 <xslt:text>
186 <text> </text>
187 </xslt:text>
188 </xslt:if>
189 </xslt:for-each>
190 <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]">
191 <xslt:text>
192 <text> </text>
193 </xslt:text>
194 </xslt:if>
195 <xslt:for-each select="$additional-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri]">
196 <xslt:value-of select="."/>
197 <xslt:if test="position()!=last()">
198 <xslt:text>
199 <text> </text>
200 </xslt:text>
201 </xslt:if>
202 </xslt:for-each>
203 </xslt:attribute>
204 </xslt:otherwise>
205 </xslt:choose>
206 </xslt:for-each>
207 <xslt:copy-of select="node()"/>
208 </xslt:copy>
209 </xslt:when>
210 <xslt:otherwise>
211 <xslt:copy-of select="."/>
212 </xslt:otherwise>
213 </xslt:choose>
214 </xslt:for-each>
215 </xslt:template>
216 <xslt:template name="书社:wrap">
217 <xslt:param name="nodes" select="/.."/>
218 <xslt:variable name="modalinput-fragment">
219 <xslt:copy-of select="$nodes"/>
220 <apply-templates select="exsl:node-set($unique-ids)" mode="书社:literally"/>
221 </xslt:variable>
222 <xslt:variable name="modalinput" select="exsl:node-set($modalinput-fragment)"/>
223 <xslt:variable name="metadata-fragment">
224 <xslt:copy-of select="$nodes[self::html:html]/html:head/node()|$nodes[self::html:head]/node()"/>
225 <xslt:apply-templates select="$modalinput/node()" mode="书社:metadata"/>
226 </xslt:variable>
227 <xslt:variable name="metadata" select="exsl:node-set($metadata-fragment)"/>
228 <html:html>
229 <xslt:copy-of select="$nodes[self::html:html]/@*"/>
230 <xslt:if test="not($nodes[self::html:html]/@书社:archived-as) and $nodes/@书社:archived-as">
231 <xslt:attribute name="书社:archived-as">
232 <xslt:value-of select="$nodes/@书社:archived-as"/>
233 </xslt:attribute>
234 </xslt:if>
235 <xslt:if test="not($nodes[self::html:html]/@lang) and $nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang">
236 <xslt:attribute name="lang">
237 <xslt:value-of select="$nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang"/>
238 </xslt:attribute>
239 </xslt:if>
240 <xslt:if test="not($nodes[self::html:html]/@xml:lang) and $nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang">
241 <xslt:attribute name="xml:lang">
242 <xslt:value-of select="$nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang"/>
243 </xslt:attribute>
244 </xslt:if>
245 <html:head>
246 <xslt:copy-of select="$nodes[self::html:html]/html:head/@*|$nodes[self::html:head]/@*"/>
247 <html:title>
248 <xslt:for-each select="$metadata/html:title">
249 <xslt:value-of select="."/>
250 <xslt:if test="position()!=last()">
251 <xslt:text>
252 <text> </text>
253 </xslt:text>
254 </xslt:if>
255 </xslt:for-each>
256 </html:title>
257 <xslt:copy-of select="$metadata/node()[not(self::html:title or self::html:meta and @name='generator')]"/>
258 <html:meta name="generator">
259 <xslt:attribute name="content">
260 <xslt:for-each select="$metadata/html:meta[@name='generator']">
261 <xslt:value-of select="@content"/>
262 <xslt:text>
263 <text>, </text>
264 </xslt:text>
265 </xslt:for-each>
266 <xslt:text>
267 <text>⛩📰 书社</text>
268 </xslt:text>
269 <xslt:if test="$THISREV">
270 <xslt:text>
271 <text> (</text>
272 </xslt:text>
273 <xslt:value-of select="$THISREV"/>
274 <xslt:text>
275 <text>)</text>
276 </xslt:text>
277 </xslt:if>
278 </xslt:attribute>
279 </html:meta>
280 </html:head>
281 <html:body>
282 <xslt:copy-of select="$nodes[self::html:html]/html:body/@*|$nodes[self::html:body]/@*"/>
283 <xslt:apply-templates select="$modalinput/node()" mode="书社:header"/>
284 <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()"/>
285 <xslt:apply-templates select="$modalinput/node()" mode="书社:footer"/>
286 </html:body>
287 </html:html>
288 </xslt:template>
289 <xslt:template match="/">
290 <xslt:variable name="finalization-fragment">
291 <xslt:apply-templates select="$书社:result" mode="书社:finalize"/>
292 </xslt:variable>
293 <xslt:copy-of select="书社:document-with-attributes-applied(exsl:node-set($finalization-fragment))"/>
294 </xslt:template>
295 <xslt:template match="@*|node()" priority="-1">
296 <xslt:copy>
297 <xslt:apply-templates select="@*|node()"/>
298 </xslt:copy>
299 </xslt:template>
300 <xslt:template match="书社:apply-attributes" mode="书社:apply" priority="1">
301 <xslt:variable name="children">
302 <xslt:apply-templates mode="书社:apply"/>
303 </xslt:variable>
304 <xslt:call-template name="书社:apply-attributes">
305 <xslt:with-param name="context-nodes" select="."/>
306 <xslt:with-param name="destination-nodes" select="exsl:node-set($children)/node()"/>
307 </xslt:call-template>
308 </xslt:template>
309 <xslt:template match="书社:apply-attributes-to-root" mode="书社:apply" priority="1">
310 <xslt:apply-templates mode="书社:apply"/>
311 </xslt:template>
312 <xslt:template match="@*|node()" mode="书社:apply" priority="-1">
313 <xslt:copy>
314 <xslt:apply-templates select="@*|node()" mode="书社:apply"/>
315 </xslt:copy>
316 </xslt:template>
317 <xslt:template match="书社:link[@xlink:show='embed' and (not(@xlink:actuate) or @xlink:actuate='none')]" mode="书社:expand" priority="1">
318 <xslt:variable name="link" select="."/>
319 <xslt:variable name="identifier" select="string(@xlink:href)"/>
320 <xslt:variable name="is-dir" select="substring($identifier, string-length($identifier))='/'"/>
321 <xslt:variable name="included" select="$书社:about//*[@rdf:about=$identifier or $is-dir and starts-with(@rdf:about, $identifier)]"/>
322 <xslt:choose>
323 <xslt:when test="$included">
324 <xslt:for-each select="$included">
325 <xslt:sort select="@rdf:about" data-type="text" lang="zxx" case-order="upper-first"/>
326 <xslt:variable name="uri" select="书社vocab:hasParsedFile/@nfo:fileUrl"/>
327 <xslt:variable name="expanded">
328 <xslt:apply-templates select="document($uri)" mode="书社:expand">
329 <xslt:with-param name="identifier" select="string(@rdf:about)"/>
330 </xslt:apply-templates>
331 </xslt:variable>
332 <xslt:for-each select="exsl:node-set($expanded)/node()">
333 <xslt:copy>
334 <xslt:choose>
335 <xslt:when test="self::html:*">
336 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
337 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
338 <xslt:attribute name="itemtype">
339 <xslt:for-each select="$existing-types/token[string()!='&书社;:document']">
340 <xslt:if test="position()!=1">
341 <xslt:text>
342 <text> </text>
343 </xslt:text>
344 </xslt:if>
345 <xslt:value-of select="."/>
346 </xslt:for-each>
347 <xslt:if test="not($existing-types/token[string()='&书社;:embed'])">
348 <xslt:if test="$existing-types/token[string()!='&书社;:document']">
349 <xslt:text>
350 <text> </text>
351 </xslt:text>
352 </xslt:if>
353 <xslt:text>
354 <text>&书社;:embed</text>
355 </xslt:text>
356 </xslt:if>
357 </xslt:attribute>
358 <xslt:choose>
359 <xslt:when test="$link/@书社:archived-as">
360 <xslt:copy-of select="$link/@书社:archived-as"/>
361 </xslt:when>
362 <xslt:when test="@书社:archived-as">
363 <xslt:copy-of select="@书社:archived-as"/>
364 </xslt:when>
365 </xslt:choose>
366 <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()"/>
367 </xslt:when>
368 <xslt:otherwise>
369 <xslt:choose>
370 <xslt:when test="self::* and $link/@书社:archived-as">
371 <xslt:copy-of select="$link/@书社:archived-as"/>
372 </xslt:when>
373 <xslt:when test="@书社:archived-as">
374 <xslt:copy-of select="@书社:archived-as"/>
375 </xslt:when>
376 </xslt:choose>
377 <xslt:copy-of select="@*[not(namespace-uri()='&书社;' and local-name()='archived-as')]|node()"/>
378 </xslt:otherwise>
379 </xslt:choose>
380 </xslt:copy>
381 </xslt:for-each>
382 </xslt:for-each>
383 </xslt:when>
384 <xslt:otherwise>
385 <xslt:copy>
386 <xslt:apply-templates select="@*|node()" mode="书社:expand"/>
387 </xslt:copy>
388 </xslt:otherwise>
389 </xslt:choose>
390 </xslt:template>
391 <xslt:template match="/node()" mode="书社:expand" priority="0">
392 <xslt:param name="identifier" select="$IDENTIFIER"/>
393 <xslt:copy>
394 <xslt:if test="self::*">
395 <xslt:attribute name="书社:cksum">
396 <xslt:value-of select="$书社:about//*[@rdf:about=$identifier]/nfo:hasHash[@nfo:hashAlgorithm='CRC32']/@nfo:hashValue"/>
397 </xslt:attribute>
398 <xslt:attribute name="书社:identifier">
399 <xslt:value-of select="$identifier"/>
400 </xslt:attribute>
401 <xslt:attribute name="书社:mtime">
402 <xslt:value-of select="$书社:about//*[@rdf:about=$identifier]/nfo:fileLastModified"/>
403 </xslt:attribute>
404 </xslt:if>
405 <xslt:choose>
406 <xslt:when test="self::html:*">
407 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
408 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
409 <xslt:attribute name="itemtype">
410 <xslt:for-each select="$existing-types/token">
411 <xslt:if test="position()!=1">
412 <xslt:text>
413 <text> </text>
414 </xslt:text>
415 </xslt:if>
416 <xslt:value-of select="."/>
417 </xslt:for-each>
418 <xslt:if test="not($existing-types/token[string()='&书社;:embed' or string()='&书社;:document'])">
419 <xslt:if test="$existing-types/token">
420 <xslt:text>
421 <text> </text>
422 </xslt:text>
423 </xslt:if>
424 <xslt:text>
425 <text>&书社;:document</text>
426 </xslt:text>
427 </xslt:if>
428 </xslt:attribute>
429 <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"/>
430 </xslt:when>
431 <xslt:otherwise>
432 <xslt:apply-templates select="@*[not(namespace-uri()='&书社;' and (local-name()='cksum' or local-name()='identifier' or local-name()='mtime'))]|node()" mode="书社:expand"/>
433 </xslt:otherwise>
434 </xslt:choose>
435 </xslt:copy>
436 </xslt:template>
437 <xslt:template match="@*|node()" mode="书社:expand" priority="-1">
438 <xslt:copy>
439 <xslt:apply-templates select="@*|node()" mode="书社:expand"/>
440 </xslt:copy>
441 </xslt:template>
442 <xslt:template match="text()" mode="书社:header"/>
443 <xslt:template match="书社:archive" mode="书社:finalize" priority="1">
444 <xslt:copy>
445 <xslt:apply-templates select="@*" mode="书社:finalize"/>
446 <xslt:for-each select="node()">
447 <xslt:choose>
448 <xslt:when test="self::*">
449 <xslt:variable name="component-fragment">
450 <xslt:copy>
451 <xslt:choose>
452 <xslt:when test="self::html:*">
453 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
454 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
455 <xslt:attribute name="itemtype">
456 <xslt:for-each select="$existing-types/token">
457 <xslt:if test="position()!=1">
458 <xslt:text>
459 <text> </text>
460 </xslt:text>
461 </xslt:if>
462 <xslt:value-of select="."/>
463 </xslt:for-each>
464 <xslt:if test="not($existing-types/token[string()='&书社;:embed' or string()='&书社;:document'])">
465 <xslt:if test="$existing-types/token">
466 <xslt:text>
467 <text> </text>
468 </xslt:text>
469 </xslt:if>
470 <xslt:text>
471 <text>&书社;:document</text>
472 </xslt:text>
473 </xslt:if>
474 </xslt:attribute>
475 <xslt:copy-of select="@*[not(namespace-uri()='' and (local-name()='itemscope' or local-name()='itemtype'))]|node()"/>
476 </xslt:when>
477 <xslt:otherwise>
478 <xslt:copy-of select="@*|node()"/>
479 </xslt:otherwise>
480 </xslt:choose>
481 </xslt:copy>
482 </xslt:variable>
483 <xslt:variable name="finalization-fragment">
484 <xslt:apply-templates select="exsl:node-set($component-fragment)" mode="书社:finalize"/>
485 </xslt:variable>
486 <xslt:copy-of select="书社:document-with-attributes-applied(exsl:node-set($finalization-fragment))"/>
487 </xslt:when>
488 <xslt:otherwise>
489 <xslt:apply-templates select="." mode="书社:finalize"/>
490 </xslt:otherwise>
491 </xslt:choose>
492 </xslt:for-each>
493 </xslt:copy>
494 </xslt:template>
495 <xslt:template match="@书社:destination|@书社:disable-output-wrapping" mode="书社:finalize" priority="1"/>
496 <xslt:template match="/" mode="书社:finalize">
497 <xslt:choose>
498 <xslt:when test="not(html:*) or 书社:raw-text or 书社:base64-binary or 书社:archive or */@书社:disable-output-wrapping">
499 <xslt:apply-templates mode="书社:finalize"/>
500 </xslt:when>
501 <xslt:otherwise>
502 <xslt:variable name="wrapped-result">
503 <xslt:call-template name="书社:wrap">
504 <xslt:with-param name="nodes" select="node()"/>
505 </xslt:call-template>
506 </xslt:variable>
507 <xslt:apply-templates select="exsl:node-set($wrapped-result)/node()" mode="书社:finalize"/>
508 </xslt:otherwise>
509 </xslt:choose>
510 </xslt:template>
511 <xslt:template match="@*|node()" mode="书社:finalize" priority="-1">
512 <xslt:copy>
513 <xslt:apply-templates select="@*|node()" mode="书社:finalize"/>
514 </xslt:copy>
515 </xslt:template>
516 <xslt:template match="text()" mode="书社:footer"/>
517 <xslt:template match="text()" mode="书社:metadata"/>
518 <xslt:output method="xml" encoding="UTF-8" cdata-section-elements="html:script html:style html:textarea 书社:raw-output 书社:raw-text"/>
519 </xslt:transform>
520 </template>
521 <output method="xml" encoding="UTF-8"/>
522 </transform>
This page took 0.09508 seconds and 3 git commands to generate.