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:xslt="http://www.w3.org/1999/XSL/TransformAlias"
 
  17         xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
 
  20         <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
 
  23                         xmlns:exsl="http://exslt.org/common"
 
  24                         extension-element-prefixes="exsl"
 
  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>
 
  32                                                         <when test="starts-with(@书社:archived-as, './')">
 
  33                                                                 <value-of select="substring-after(@书社:archived-as, './')"/>
 
  36                                                                 <value-of select="@书社:archived-as"/>
 
  40                                         <exsl:document href="{$href}" method="xml" encoding="UTF-8">
 
  41                                                 <xslt:variable name="href">
 
  42                                                         <value-of select="@书社:archived-as"/>
 
  44                                                 <xslt:copy-of select="书社:archive/*[@书社:archived-as=$href][1]"/>
 
  47                                                 <value-of select="$href"/>
 
  52                         <xslt:output method="text" encoding="UTF-8"/>
 
  55         <output method="xml" encoding="UTF-8"/>