]> Lady’s Gitweb - Shushe/blob - transforms/asset.xslt
Don’t use literal result elements in transforms
[Shushe] / transforms / asset.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 ⁌ ⛩📰 书社 ∷ transforms/asset.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 wrapped "ancestor::html:html[not(parent::* or @书社:disable-output-wrapping)]">
16 <!ENTITY xhtml "http://www.w3.org/1999/xhtml">
17 ]>
18 <transform
19 xmlns="http://www.w3.org/1999/XSL/Transform"
20 xmlns:exsl="http://exslt.org/common"
21 xmlns:html="&xhtml;"
22 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
23 extension-element-prefixes="exsl"
24 version="1.0"
25 >
26 <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt</书社:id>
27 <template match="html:style[&wrapped; and not(ancestor::html:head)]|html:object[@type='text/css' and &wrapped;]" mode="书社:finalize" priority="0"/>
28 <template match="html:object[@type='text/javascript']" mode="书社:finalize" priority="0">
29 <element name="script" namespace="&xhtml;">
30 <attribute name="type">
31 <value-of select="@type"/>
32 </attribute>
33 <attribute name="src">
34 <value-of select="@data"/>
35 </attribute>
36 <copy-of select="@书社:identifier"/>
37 </element>
38 </template>
39 <template match="html:object[starts-with(@type, 'audio/')]" mode="书社:finalize" priority="0">
40 <element name="audio" namespace="&xhtml;">
41 <attribute name="controls"/>
42 <attribute name="src">
43 <value-of select="@data"/>
44 </attribute>
45 <copy-of select="@书社:identifier"/>
46 </element>
47 </template>
48 <template match="html:object[starts-with(@type, 'image/') and not(@type='image/svg+xml')]" mode="书社:finalize" priority="0">
49 <element name="img" namespace="&xhtml;">
50 <attribute name="src">
51 <value-of select="@data"/>
52 </attribute>
53 <copy-of select="@书社:identifier|@width|@height"/>
54 </element>
55 </template>
56 <template match="html:object[starts-with(@type, 'video/')]" mode="书社:finalize" priority="0">
57 <element name="video" namespace="&xhtml;">
58 <attribute name="controls"/>
59 <attribute name="src">
60 <value-of select="@data"/>
61 </attribute>
62 <copy-of select="@书社:identifier|@width|@height"/>
63 </element>
64 </template>
65 <template match="书社:id[string(.)='urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt']" mode="书社:metadata">
66 <for-each select="$书社:expansion//html:object[@type='text/css']">
67 <element name="link" namespace="&xhtml;">
68 <attribute name="rel">
69 <text>stylesheet</text>
70 </attribute>
71 <attribute name="type">
72 <text>text/css</text>
73 </attribute>
74 <attribute name="href">
75 <value-of select="@data"/>
76 </attribute>
77 <copy-of select="@书社:identifier"/>
78 </element>
79 </for-each>
80 <for-each select="$书社:expansion//html:style[not(ancestor::html:head)]">
81 <copy-of select="."/>
82 </for-each>
83 </template>
84 </transform>
This page took 0.089257 seconds and 5 git commands to generate.