]> Lady’s Gitweb - Shushe/blob - lib/archive2extractor.xslt
Make <书社:raw-text> a C·data section element
[Shushe] / lib / archive2extractor.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 ⁌ ⛩️📰 书社 ∷ lib/archive2extractor.xslt
8
9 © 2024 Lady [@ Lady’s 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:xslt="http://www.w3.org/1999/XSL/TransformAlias"
17 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
18 version="1.0"
19 >
20 <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
21 <template match="/">
22 <xslt:transform
23 xmlns:exsl="http://exslt.org/common"
24 extension-element-prefixes="exsl"
25 version="1.0"
26 >
27 <xslt:template match="/">
28 <for-each select="书社:archive/*[@书社:archived-as and not(starts-with(@书社:archived-as, '../') or starts-with(@书社:archived-as, '/') or contains(@书社:archived-as, '/../'))]">
29 <variable name="href">
30 <text>./extracted/</text>
31 <choose>
32 <when test="starts-with(@书社:archived-as, './')">
33 <value-of select="substring-after(@书社:archived-as, './')"/>
34 </when>
35 <otherwise>
36 <value-of select="@书社:archived-as"/>
37 </otherwise>
38 </choose>
39 </variable>
40 <exsl:document href="{$href}" method="xml" encoding="UTF-8">
41 <xslt:variable name="href">
42 <value-of select="@书社:archived-as"/>
43 </xslt:variable>
44 <xslt:copy-of select="书社:archive/*[@书社:archived-as=$href][1]"/>
45 </exsl:document>
46 <xslt:text>
47 <value-of select="$href"/>
48 <text>&#xA;</text>
49 </xslt:text>
50 </for-each>
51 </xslt:template>
52 <xslt:output method="text" encoding="UTF-8"/>
53 </xslt:transform>
54 </template>
55 <output method="xml" encoding="UTF-8"/>
56 </transform>
This page took 0.058881 seconds and 5 git commands to generate.