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