3 SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
7 ⁌ ⛩️📰 书社 ∷ transforms/serialization.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:html="http://www.w3.org/1999/xhtml"
19 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
20 extension-element-prefixes="exsl exslstr"
23 <import href="../lib/serialize.xslt"/>
24 <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:serialization.xslt</书社:id>
25 <template match="书社:serialize-xml" mode="书社:apply" priority="1">
26 <variable name="namespaces" select="namespace::*"/>
27 <variable name="contents">
28 <apply-templates mode="书社:apply"/>
30 <variable name="passthru-namespaces" select="exslstr:tokenize(string(@with-namespaces))"/>
31 <apply-templates select="exsl:node-set($contents)" mode="书社:serialize">
32 <with-param name="namespace">
33 <value-of select="namespace::*[local-name()='']"/>
35 <with-param name="declare-namespaces">
36 <if test="$passthru-namespaces[string(.)='xml']">
37 <text> http://www.w3.org/XML/1998/namespace</text>
39 <for-each select="namespace::*[local-name()!='xml']">
40 <if test="local-name()='' and $passthru-namespaces[string(.)='#default'] or $passthru-namespaces[string(.)=local-name(current())]">
42 <value-of select="string(.)"/>
47 <with-param name="prefix-map">
50 <html:dt>xml</html:dt>
51 <html:dd>http://www.w3.org/XML/1998/namespace</html:dd>
53 <for-each select="namespace::*[local-name()!='' and local-name()!='xml']">
56 <value-of select="local-name()"/>
59 <value-of select="string(.)"/>
67 <template match="书社:raw-output" mode="书社:serialize" priority="1">
68 <copy-of select=".//text()"/>