3 SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
7 ⁌ ⛩️📰 书社 ∷ lib/paged2extractor.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:exslstr="http://exslt.org/strings"
18 xmlns:xslt="http://www.w3.org/1999/XSL/TransformAlias"
19 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
22 <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
25 <xslt:transform extension-element-prefixes="exsl exslstr" version="1.0">
26 <xslt:template match="@*|node()">
27 <xslt:param name="destination" select="''"/>
29 <xslt:when test="self::书社:page">
30 <xslt:apply-templates>
31 <xslt:with-param name="destination" select="$destination"/>
32 </xslt:apply-templates>
34 <xslt:when test="$destination='' and not(ancestor::书社:page) or string(ancestor::书社:page[1]/@书社:destination)=$destination">
36 <xslt:apply-templates>
37 <xslt:with-param name="destination" select="$destination"/>
38 </xslt:apply-templates>
42 <xslt:apply-templates>
43 <xslt:with-param name="destination" select="$destination"/>
44 </xslt:apply-templates>
48 <xslt:template match="/" priority="1">
49 <exsl:document href="./pages/{$NAME}" method="xml" encoding="UTF-8">
50 <xslt:apply-templates/>
54 <value-of select="$NAME"/>
57 <for-each select="//书社:page[@书社:destination]">
58 <if test="not(ancestor::书社:page[@书社:destination=current()/@书社:destination] or preceding::书社:page[@书社:destination=current()/@书社:destination])">
59 <variable name="href">
61 <value-of select="exslstr:tokenize(@书社:destination, '/')[last()]"/>
63 <exsl:document href="{$href}" method="xml" encoding="UTF-8">
64 <xslt:apply-templates>
65 <xslt:with-param name="destination">
66 <value-of select="@书社:destination"/>
68 </xslt:apply-templates>
72 <when test="contains($href, '%22%7B')">
73 <value-of select="substring-before($href, '%22%7B')"/>
75 <value-of select="substring-before(substring-after($href, '%22%7B'), '%7D%22')"/>
77 <value-of select="substring-after(substring-after($href, '%22%7B'), '%7D%22')"/>
80 <value-of select="$href"/>
88 <xslt:output method="text" encoding="UTF-8"/>
91 <output method="xml" encoding="UTF-8"/>