]> Lady’s Gitweb - Shushe/blobdiff - lib/catalog2destinations.xslt
Fix base64 decoding
[Shushe] / lib / catalog2destinations.xslt
index cadb0c31cc3200f44f1e5eb81fd03b2287bce9bf..ae1ea29cfd455621e40b57b9d54b68dac42d6898 100644 (file)
@@ -1,8 +1,12 @@
 <?xml version="1.0"?>
 <!--
+SPDX-FileCopyrightText: 2023, 2024 Lady <https://www.ladys.computer/about/#lady>
+SPDX-License-Identifier: MPL-2.0
+-->
+<!--
 ⁌ ⛩️📰 书社 ∷ lib/catalog2destinations.xslt
 
-© 2024 Lady [@ Lady’s Computer]
+© 2024 Lady [@ Lady’s Computer].
 
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 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/>.
@@ -10,7 +14,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:catalog="urn:oasis:names:tc:entity:xmlns:xml:catalog"
+       xmlns:exslstr="http://exslt.org/strings"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
+       extension-element-prefixes="exslstr"
        version="1.0"
 >
        <template match="/">
@@ -22,7 +28,23 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                        <text>|</text>
                                        <choose>
                                                <when test="$destination">
-                                                       <value-of select="$destination"/>
+                                                       <variable name="dir">
+                                                               <for-each select="exslstr:tokenize($destination, '/')[not(position()=last())]">
+                                                                       <value-of select="."/>
+                                                                       <text>/</text>
+                                                               </for-each>
+                                                       </variable>
+                                                       <variable name="name" select="string(exslstr:tokenize($destination, '/')[last()])"/>
+                                                       <value-of select="$dir"/>
+                                                       <choose>
+                                                               <when test="contains($name, '%s')">
+                                                                       <value-of select="substring-before($name, '%s')"/>
+                                                                       <value-of select="substring-after($name, '%s')"/>
+                                                               </when>
+                                                               <otherwise>
+                                                                       <value-of select="$name"/>
+                                                               </otherwise>
+                                                       </choose>
                                                </when>
                                                <otherwise>
                                                        <value-of select="substring-after(@name, 'about:shushe?source=')"/>
This page took 0.124504 seconds and 4 git commands to generate.