]> Lady’s Gitweb - Shushe/blobdiff - lib/literally.xslt
Simplify two‐step build
[Shushe] / lib / literally.xslt
index dc104e1f89ae28db059add98a8f4447cff12d408..d929f2f61a5a63e1f8f28f95d7b1445221d94585 100644 (file)
@@ -4,9 +4,9 @@ SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
 SPDX-License-Identifier: MPL-2.0
 -->
 <!--
 SPDX-License-Identifier: MPL-2.0
 -->
 <!--
-⁌ ⛩📰 书社 ∷ lib/literally.xslt
+⁌ ⛩📰 书社 ∷ lib/literally.xslt
 
 
-© 2024 Lady [@ Ladys Computer].
+© 2024 Lady [@ Ladys 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/>.
 
 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/>.
@@ -18,8 +18,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        version="1.0"
 >
        <template match="node()" mode="书社:literally">
        version="1.0"
 >
        <template match="node()" mode="书社:literally">
+               <param name="extension-element-namespaces"/>
                <choose>
                <choose>
-                       <when test="self::*">
+                       <when test="self::* and contains(concat(' http://www.w3.org/1999/XSL/Transform ', normalize-space($extension-element-namespaces), ' '), concat(' ', namespace-uri(), ' '))">
                                <xslt:element name="{name()}" namespace="{namespace-uri()}">
                                        <for-each select="@*">
                                                <xslt:attribute name="{name()}" namespace="{namespace-uri()}">
                                <xslt:element name="{name()}" namespace="{namespace-uri()}">
                                        <for-each select="@*">
                                                <xslt:attribute name="{name()}" namespace="{namespace-uri()}">
@@ -31,6 +32,23 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                        <apply-templates mode="书社:literally"/>
                                </xslt:element>
                        </when>
                                        <apply-templates mode="书社:literally"/>
                                </xslt:element>
                        </when>
+                       <when test="self::*">
+                               <element name="{name()}" namespace="{namespace-uri()}">
+                                       <for-each select="@*[not(contains(., '{') or contains(., '}'))]">
+                                               <attribute name="{name()}" namespace="{namespace-uri()}">
+                                                       <value-of select="."/>
+                                               </attribute>
+                                       </for-each>
+                                       <for-each select="@*[contains(., '{') or contains(., '}')]">
+                                               <xslt:attribute name="{name()}" namespace="{namespace-uri()}">
+                                                       <xslt:text>
+                                                               <value-of select="."/>
+                                                       </xslt:text>
+                                               </xslt:attribute>
+                                       </for-each>
+                                       <apply-templates mode="书社:literally"/>
+                               </element>
+                       </when>
                        <when test="self::text()">
                                <xslt:text>
                                        <value-of select="."/>
                        <when test="self::text()">
                                <xslt:text>
                                        <value-of select="."/>
This page took 0.023349 seconds and 4 git commands to generate.