3 SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
7 ⁌ ⛩️📰 书社 ∷ lib/archive2extractor.xslt
9 © 2024 Lady [@ Lady’s Computer].
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/>.
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"
21 <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
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>
29 <when test="starts-with(@书社:archived-as, './')">
30 <value-of select="substring-after(@书社:archived-as, './')"/>
33 <value-of select="@书社:archived-as"/>
37 <exsl:document href="{$href}" method="xml" encoding="UTF-8">
38 <xslt:variable name="href">
39 <value-of select="@书社:archived-as"/>
41 <xslt:copy-of select="书社:archive/*[@书社:archived-as=$href][1]"/>
44 <value-of select="$href"/>
49 <xslt:output method="text" encoding="UTF-8"/>
52 <output method="xml" encoding="UTF-8"/>