]> Lady’s Gitweb - Shushe/blob - lib/catalog2destinations.xslt
Support pagination
[Shushe] / lib / catalog2destinations.xslt
1 <?xml version="1.0"?>
2 <!--
3 SPDX-FileCopyrightText: 2023, 2024 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
5 -->
6 <!--
7 ⁌ ⛩️📰 书社 ∷ lib/catalog2destinations.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:catalog="urn:oasis:names:tc:entity:xmlns:xml:catalog"
17 xmlns:exslstr="http://exslt.org/strings"
18 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
19 extension-element-prefixes="exslstr"
20 version="1.0"
21 >
22 <template match="/">
23 <for-each select="//catalog:uri[starts-with(@name, 'about:shushe?source=')]">
24 <choose>
25 <when test="substring-after(@uri, '#')='xml'">
26 <variable name="destination" select="document(substring-before(@uri, '#'), .)/*/@书社:destination"/>
27 <value-of select="@name"/>
28 <text>|</text>
29 <choose>
30 <when test="$destination">
31 <variable name="dir">
32 <for-each select="exslstr:tokenize($destination, '/')[not(position()=last())]">
33 <value-of select="."/>
34 <text>/</text>
35 </for-each>
36 </variable>
37 <variable name="name" select="string(exslstr:tokenize($destination, '/')[last()])"/>
38 <value-of select="$dir"/>
39 <choose>
40 <when test="contains($name, '%s')">
41 <value-of select="substring-before($name, '%s')"/>
42 <value-of select="substring-after($name, '%s')"/>
43 </when>
44 <otherwise>
45 <value-of select="$name"/>
46 </otherwise>
47 </choose>
48 </when>
49 <otherwise>
50 <value-of select="substring-after(@name, 'about:shushe?source=')"/>
51 </otherwise>
52 </choose>
53 <text>&#xA;</text>
54 </when>
55 <otherwise>
56 <value-of select="@name"/>
57 <text>|</text>
58 <value-of select="substring-after(@name, 'about:shushe?source=')"/>
59 <text>&#xA;</text>
60 </otherwise>
61 </choose>
62 </for-each>
63 </template>
64 <output method="text" encoding="UTF-8"/>
65 </transform>
This page took 0.059258 seconds and 5 git commands to generate.