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