<?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/>.
<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="/">
<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=')"/>