]> Lady’s Gitweb - Shushe/blob - lib/parser2types.xslt
Simplify recursive dependency error printing
[Shushe] / lib / parser2types.xslt
1 <?xml version="1.0"?>
2 <!--
3 ⁌ ⛩️📰 书社 ∷ lib/parser2types.xslt
4
5 © 2023–2024 Lady [@ Lady’s Computer]
6
7 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
8 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/>.
9 -->
10 <transform
11 xmlns="http://www.w3.org/1999/XSL/Transform"
12 xmlns:catalog="urn:oasis:names:tc:entity:xmlns:xml:catalog"
13 xmlns:exslstr="http://exslt.org/strings"
14 xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
15 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
16 version="1.0"
17 >
18 <template match="/">
19 <for-each select="//xslt:include">
20 <variable name="included" select="document(@href, .)"/>
21 <choose>
22 <when test="$included/*/@书社:supported-media-types">
23 <for-each select="exslstr:tokenize($included/*/@书社:supported-media-types)">
24 <if test="not(translate(., '0123456789abcdefghijklmnopqrstuvwxyz!#$&#x26;-^_.+/', ''))">
25 <value-of select="."/>
26 <text>&#xA;</text>
27 </if>
28 </for-each>
29 </when>
30 <otherwise>
31 <for-each select="$included//xslt:template[not(@name) and not(@mode)]">
32 <variable name="match" select="@match"/>
33 <for-each select="namespace::*[local-name() and string()='http://www.w3.org/1999/xhtml']">
34 <variable name="matchstart">
35 <value-of select="local-name()"/>
36 <text>:</text>
37 <text>script[@type=</text>
38 </variable>
39 <if test="starts-with($match, $matchstart) and substring($match, string-length($match))=']' and contains($match, '/')">
40 <variable name="inner" select="substring-before(substring-after($match, $matchstart), ']')"/>
41 <if test="starts-with($inner, '&#x22;') and substring($inner, string-length($inner))='&#x22;' or starts-with($inner, &#x22;'&#x22;) and substring($inner, string-length($inner))=&#x22;'&#x22;">
42 <variable name="type" select="substring($inner, 2, string-length($inner)-2)"/>
43 <if test="not(translate($type, '0123456789abcdefghijklmnopqrstuvwxyz!#$&#x26;-^_.+/', ''))">
44 <value-of select="$type"/>
45 <text>&#xA;</text>
46 </if>
47 </if>
48 </if>
49 </for-each>
50 </for-each>
51 </otherwise>
52 </choose>
53 </for-each>
54 </template>
55 <output method="text" encoding="UTF-8"/>
56 </transform>
This page took 0.318185 seconds and 5 git commands to generate.