]> Lady’s Gitweb - Shushe/blob - lib/catalog2transform.xslt
Add DATAOPTS
[Shushe] / lib / catalog2transform.xslt
1 <?xml version="1.0"?>
2 <!--
3 SPDX-FileCopyrightText: 2023, 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
5 -->
6 <!--
7 ⁌ ⛩📰 书社 ∷ lib/catalog2transform.xslt
8
9 © 2023–2025 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]/@*)[not(namespace-uri()='&书社;' and local-name()='archived-as')]"/>
284 <xslt:apply-templates select="$modalinput/node()" mode="书社:header"/>
285 <xslt:for-each 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:copy>
287 <xslt:copy-of select="@*[not(namespace-uri()='&书社;' and local-name()='archived-as')]|node()"/>
288 </xslt:copy>
289 </xslt:for-each>
290 <xslt:apply-templates select="$modalinput/node()" mode="书社:footer"/>
291 </xslt:element>
292 </xslt:element>
293 </xslt:template>
294 <xslt:template match="/">
295 <xslt:variable name="finalization-fragment">
296 <xslt:apply-templates select="$书社:result" mode="书社:finalize"/>
297 </xslt:variable>
298 <xslt:copy-of select="书社:document-with-attributes-applied(exsl:node-set($finalization-fragment))"/>
299 </xslt:template>
300 <xslt:template match="@*|node()" priority="-1">
301 <xslt:copy>
302 <xslt:apply-templates select="@*|node()"/>
303 </xslt:copy>
304 </xslt:template>
305 <xslt:template match="书社:apply-attributes" mode="书社:apply" priority="1">
306 <xslt:variable name="children">
307 <xslt:apply-templates mode="书社:apply"/>
308 </xslt:variable>
309 <xslt:call-template name="书社:apply-attributes">
310 <xslt:with-param name="context-nodes" select="."/>
311 <xslt:with-param name="destination-nodes" select="exsl:node-set($children)/node()"/>
312 </xslt:call-template>
313 </xslt:template>
314 <xslt:template match="书社:apply-attributes-to-root" mode="书社:apply" priority="1">
315 <xslt:apply-templates mode="书社:apply"/>
316 </xslt:template>
317 <xslt:template match="@*|node()" mode="书社:apply" priority="-1">
318 <xslt:copy>
319 <xslt:apply-templates select="@*|node()" mode="书社:apply"/>
320 </xslt:copy>
321 </xslt:template>
322 <xslt:template match="书社:link[@xlink:show='embed' and (not(@xlink:actuate) or @xlink:actuate='none')]" mode="书社:expand" priority="1">
323 <xslt:variable name="link" select="."/>
324 <xslt:variable name="identifier" select="string(@xlink:href)"/>
325 <xslt:variable name="is-dir" select="substring($identifier, string-length($identifier))='/'"/>
326 <xslt:variable name="included" select="$书社:about//*[@rdf:about=$identifier or $is-dir and starts-with(@rdf:about, $identifier)]"/>
327 <xslt:choose>
328 <xslt:when test="$included">
329 <xslt:for-each select="$included">
330 <xslt:sort select="@rdf:about" data-type="text" lang="zxx" case-order="upper-first"/>
331 <xslt:variable name="uri" select="书社vocab:hasParsedFile/@nfo:fileUrl"/>
332 <xslt:variable name="expanded">
333 <xslt:apply-templates select="document($uri)" mode="书社:expand">
334 <xslt:with-param name="identifier" select="string(@rdf:about)"/>
335 </xslt:apply-templates>
336 </xslt:variable>
337 <xslt:for-each select="exsl:node-set($expanded)/node()">
338 <xslt:copy>
339 <xslt:choose>
340 <xslt:when test="self::html:*">
341 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
342 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
343 <xslt:attribute name="itemtype">
344 <xslt:for-each select="$existing-types/token[string()!='&书社;:document']">
345 <xslt:if test="position()!=1">
346 <xslt:text>
347 <text> </text>
348 </xslt:text>
349 </xslt:if>
350 <xslt:value-of select="."/>
351 </xslt:for-each>
352 <xslt:if test="not($existing-types/token[string()='&书社;:embed'])">
353 <xslt:if test="$existing-types/token[string()!='&书社;:document']">
354 <xslt:text>
355 <text> </text>
356 </xslt:text>
357 </xslt:if>
358 <xslt:text>
359 <text>&书社;:embed</text>
360 </xslt:text>
361 </xslt:if>
362 </xslt:attribute>
363 <xslt:choose>
364 <xslt:when test="$link/@书社:archived-as">
365 <xslt:copy-of select="$link/@书社:archived-as"/>
366 </xslt:when>
367 <xslt:when test="@书社:archived-as">
368 <xslt:copy-of select="@书社:archived-as"/>
369 </xslt:when>
370 </xslt:choose>
371 <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()"/>
372 </xslt:when>
373 <xslt:otherwise>
374 <xslt:choose>
375 <xslt:when test="self::* and $link/@书社:archived-as">
376 <xslt:copy-of select="$link/@书社:archived-as"/>
377 </xslt:when>
378 <xslt:when test="@书社:archived-as">
379 <xslt:copy-of select="@书社:archived-as"/>
380 </xslt:when>
381 </xslt:choose>
382 <xslt:copy-of select="@*[not(namespace-uri()='&书社;' and local-name()='archived-as')]|node()"/>
383 </xslt:otherwise>
384 </xslt:choose>
385 </xslt:copy>
386 </xslt:for-each>
387 </xslt:for-each>
388 </xslt:when>
389 <xslt:otherwise>
390 <xslt:copy>
391 <xslt:apply-templates select="@*|node()" mode="书社:expand"/>
392 </xslt:copy>
393 </xslt:otherwise>
394 </xslt:choose>
395 </xslt:template>
396 <xslt:template match="/node()" mode="书社:expand" priority="0">
397 <xslt:param name="identifier" select="$IDENTIFIER"/>
398 <xslt:copy>
399 <xslt:if test="self::*">
400 <xslt:attribute name="书社:cksum">
401 <xslt:value-of select="$书社:about//*[@rdf:about=$identifier]/nfo:hasHash[@nfo:hashAlgorithm='CRC32']/@nfo:hashValue"/>
402 </xslt:attribute>
403 <xslt:attribute name="书社:identifier">
404 <xslt:value-of select="$identifier"/>
405 </xslt:attribute>
406 <xslt:attribute name="书社:mtime">
407 <xslt:value-of select="$书社:about//*[@rdf:about=$identifier]/nfo:fileLastModified"/>
408 </xslt:attribute>
409 </xslt:if>
410 <xslt:choose>
411 <xslt:when test="self::html:*">
412 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
413 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
414 <xslt:attribute name="itemtype">
415 <xslt:for-each select="$existing-types/token">
416 <xslt:if test="position()!=1">
417 <xslt:text>
418 <text> </text>
419 </xslt:text>
420 </xslt:if>
421 <xslt:value-of select="."/>
422 </xslt:for-each>
423 <xslt:if test="not($existing-types/token[string()='&书社;:embed' or string()='&书社;:document'])">
424 <xslt:if test="$existing-types/token">
425 <xslt:text>
426 <text> </text>
427 </xslt:text>
428 </xslt:if>
429 <xslt:text>
430 <text>&书社;:document</text>
431 </xslt:text>
432 </xslt:if>
433 </xslt:attribute>
434 <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"/>
435 </xslt:when>
436 <xslt:otherwise>
437 <xslt:apply-templates select="@*[not(namespace-uri()='&书社;' and (local-name()='cksum' or local-name()='identifier' or local-name()='mtime'))]|node()" mode="书社:expand"/>
438 </xslt:otherwise>
439 </xslt:choose>
440 </xslt:copy>
441 </xslt:template>
442 <xslt:template match="@*|node()" mode="书社:expand" priority="-1">
443 <xslt:copy>
444 <xslt:apply-templates select="@*|node()" mode="书社:expand"/>
445 </xslt:copy>
446 </xslt:template>
447 <xslt:template match="text()" mode="书社:header"/>
448 <xslt:template match="书社:archive" mode="书社:finalize" priority="1">
449 <xslt:copy>
450 <xslt:apply-templates select="@*" mode="书社:finalize"/>
451 <xslt:for-each select="node()">
452 <xslt:choose>
453 <xslt:when test="self::*">
454 <xslt:variable name="component-fragment">
455 <xslt:copy>
456 <xslt:choose>
457 <xslt:when test="self::html:*">
458 <xslt:variable name="existing-types" select="exslstr:tokenize(@itemtype)"/>
459 <xslt:attribute name="itemscope">itemscope</xslt:attribute>
460 <xslt:attribute name="itemtype">
461 <xslt:for-each select="$existing-types/token">
462 <xslt:if test="position()!=1">
463 <xslt:text>
464 <text> </text>
465 </xslt:text>
466 </xslt:if>
467 <xslt:value-of select="."/>
468 </xslt:for-each>
469 <xslt:if test="not($existing-types/token[string()='&书社;:embed' or string()='&书社;:document'])">
470 <xslt:if test="$existing-types/token">
471 <xslt:text>
472 <text> </text>
473 </xslt:text>
474 </xslt:if>
475 <xslt:text>
476 <text>&书社;:document</text>
477 </xslt:text>
478 </xslt:if>
479 </xslt:attribute>
480 <xslt:copy-of select="@*[not(namespace-uri()='' and (local-name()='itemscope' or local-name()='itemtype'))]|node()"/>
481 </xslt:when>
482 <xslt:otherwise>
483 <xslt:copy-of select="@*|node()"/>
484 </xslt:otherwise>
485 </xslt:choose>
486 </xslt:copy>
487 </xslt:variable>
488 <xslt:variable name="finalization-fragment">
489 <xslt:apply-templates select="exsl:node-set($component-fragment)" mode="书社:finalize"/>
490 </xslt:variable>
491 <xslt:copy-of select="书社:document-with-attributes-applied(exsl:node-set($finalization-fragment))"/>
492 </xslt:when>
493 <xslt:otherwise>
494 <xslt:apply-templates select="." mode="书社:finalize"/>
495 </xslt:otherwise>
496 </xslt:choose>
497 </xslt:for-each>
498 </xslt:copy>
499 </xslt:template>
500 <xslt:template match="@书社:destination|@书社:disable-output-wrapping" mode="书社:finalize" priority="1"/>
501 <xslt:template match="/" mode="书社:finalize">
502 <xslt:choose>
503 <xslt:when test="not(html:*) or 书社:raw-text or 书社:base64-binary or 书社:archive or */@书社:disable-output-wrapping">
504 <xslt:apply-templates mode="书社:finalize"/>
505 </xslt:when>
506 <xslt:otherwise>
507 <xslt:variable name="wrapped-result">
508 <xslt:call-template name="书社:wrap">
509 <xslt:with-param name="nodes" select="node()"/>
510 </xslt:call-template>
511 </xslt:variable>
512 <xslt:apply-templates select="exsl:node-set($wrapped-result)/node()" mode="书社:finalize"/>
513 </xslt:otherwise>
514 </xslt:choose>
515 </xslt:template>
516 <xslt:template match="@*|node()" mode="书社:finalize" priority="-1">
517 <xslt:copy>
518 <xslt:apply-templates select="@*|node()" mode="书社:finalize"/>
519 </xslt:copy>
520 </xslt:template>
521 <xslt:template match="text()" mode="书社:footer"/>
522 <xslt:template match="text()" mode="书社:metadata"/>
523 <xslt:output method="xml" encoding="UTF-8" cdata-section-elements="html:script html:style html:textarea 书社:raw-output 书社:raw-text"/>
524 </xslt:transform>
525 </template>
526 <output method="xml" encoding="UTF-8"/>
527 </transform>
This page took 0.072146 seconds and 5 git commands to generate.