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