]> Lady’s Gitweb - Shushe/blob - lib/parser2types.xslt
Initial commit; minimal working implementation
[Shushe] / lib / parser2types.xslt
1 <?xml version="1.0"?>
2 <!--
3 ⁌ ⛩️📰 书社 ∷ lib/parser2types.xslt
4
5 © 2023 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:xslt="http://www.w3.org/1999/XSL/Transform"
14 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
15 version="1.0"
16 >
17 <template match="/">
18 <for-each select="//xslt:include">
19 <for-each select="document(@href, .)//xslt:template[not(@name) and not(@mode)]">
20 <variable name="match" select="@match"/>
21 <for-each select="namespace::*[local-name() and string()='http://www.w3.org/1999/xhtml']">
22 <variable name="matchstart">
23 <value-of select="local-name()"/>
24 <text>:</text>
25 <text>script[@type=</text>
26 </variable>
27 <if test="starts-with($match, $matchstart) and substring($match, string-length($match))=']' and contains($match, '/')">
28 <variable name="inner" select="substring-before(substring-after($match, $matchstart), ']')"/>
29 <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;">
30 <variable name="type" select="substring($inner, 2, string-length($inner)-2)"/>
31 <if test="not(translate($type, '0123456789abcdefghijklmnopqrstuvwxyz!#$&#x26;-^_.+/', ''))">
32 <value-of select="$type"/>
33 <text>&#xA;</text>
34 </if>
35 </if>
36 </if>
37 </for-each>
38 </for-each>
39 </for-each>
40 </template>
41 <output method="text" encoding="UTF-8"/>
42 </transform>
This page took 0.113571 seconds and 5 git commands to generate.