]> Lady’s Gitweb - Shushe/blob - lib/archive2extractor.xslt
Add @data-tsv-header to TSV data cells
[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: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:copy-of select="书社:archive/*[@书社:archived-as=$href][1]"/>
42 </exsl:document>
43 <xslt:text>
44 <value-of select="$href"/>
45 <text>&#xA;</text>
46 </xslt:text>
47 </for-each>
48 </xslt:template>
49 <xslt:output method="text" encoding="UTF-8"/>
50 </xslt:transform>
51 </template>
52 <output method="xml" encoding="UTF-8"/>
53 </transform>
This page took 0.248926 seconds and 5 git commands to generate.