]> Lady’s Gitweb - Shushe/blob - parsers/record-jar.xslt
Delete installed directories during uninstall
[Shushe] / parsers / record-jar.xslt
1 <?xml version="1.0"?>
2 <!--
3 SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
5 -->
6 <!--
7 ⁌ ⛩📰 书社 ∷ parsers/record-jar.xslt
8
9 © 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 <transform
15 xmlns="http://www.w3.org/1999/XSL/Transform"
16 xmlns:exsl="http://exslt.org/common"
17 xmlns:exslstr="http://exslt.org/strings"
18 xmlns:html="http://www.w3.org/1999/xhtml"
19 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
20 extension-element-prefixes="exsl exslstr"
21 version="1.0"
22 >
23 <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:record-jar.xslt</书社:id>
24 <template match="html:script[@type='text/record-jar']">
25 <variable name="lines" select="exslstr:tokenize(., '&#xA;')"/>
26 <html:div>
27 <if test="starts-with($lines[1], '%%') and substring-after($lines[1], '%%')!=''">
28 <comment>
29 <value-of select="substring-after($lines[1], '%%')"/>
30 </comment>
31 </if>
32 <for-each select="$lines[not(position()=1) and starts-with(., '%%')]">
33 <variable name="end" select="."/>
34 <variable name="start" select="preceding-sibling::*[starts-with(., '%%')][1]"/>
35 <variable name="fields" select="($start/following-sibling::*|$lines[not($start)])[not(preceding-sibling::*[generate-id()=generate-id($end)]) and not(starts-with(., '%%'))]"/>
36 <if test="$fields">
37 <html:dl>
38 <for-each select="$fields">
39 <choose>
40 <when test="starts-with(., ' ') and $fields[generate-id()=generate-id(current()/preceding-sibling::*[1])]"/>
41 <otherwise>
42 <variable name="next" select="following-sibling::*[not(starts-with(., ' '))]"/>
43 <html:div>
44 <html:dt>
45 <value-of select="normalize-space(substring-before(., ':'))"/>
46 </html:dt>
47 <html:dd>
48 <variable name="firstline">
49 <choose>
50 <when test="contains(., ':')">
51 <value-of select="normalize-space(substring-after(., ':'))"/>
52 </when>
53 <otherwise>
54 <value-of select="normalize-space(.)"/>
55 </otherwise>
56 </choose>
57 </variable>
58 <choose>
59 <when test="substring($firstline, string-length($firstline))='\' and following-sibling::*[position()=1 and starts-with(., ' ')]">
60 <value-of select="substring($firstline, 1, string-length($firstline)-1)"/>
61 </when>
62 <otherwise>
63 <value-of select="$firstline"/>
64 </otherwise>
65 </choose>
66 <for-each select="following-sibling::*[starts-with(., ' ') and not(preceding-sibling::*[generate-id()=generate-id($next)])]">
67 <variable name="nextline" select="normalize-space(.)"/>
68 <choose>
69 <when test="substring($nextline, string-length($nextline))='\' and following-sibling::*[position()=1 and starts-with(., ' ')]">
70 <value-of select="substring($nextline, 1, string-length($nextline)-1)"/>
71 </when>
72 <otherwise>
73 <value-of select="$nextline"/>
74 </otherwise>
75 </choose>
76 </for-each>
77 </html:dd>
78 </html:div>
79 </otherwise>
80 </choose>
81 </for-each>
82 </html:dl>
83 </if>
84 <if test="substring-after(., '%%')!=''">
85 <comment>
86 <value-of select="substring-after(., '%%')"/>
87 </comment>
88 </if>
89 </for-each>
90 </html:div>
91 </template>
92 </transform>
This page took 0.062262 seconds and 5 git commands to generate.