]> Lady’s Gitweb - Shushe/commitdiff
Provide template identifiers as <书社:id>s
authorLady <redacted>
Mon, 27 May 2024 21:16:23 +0000 (17:16 -0400)
committerLady <redacted>
Thu, 11 Jul 2024 01:46:30 +0000 (21:46 -0400)
This is definitely going to break existing websites, but it’s much more
sensible and straightforward to deal with, in my opinion. Alternatives
included instead providing them as comments or processing instructions,
which would be much harder to process.

README.markdown
lib/catalog2transform.xslt
transforms/asset.xslt

index 013e3ede21843de1ae5653e6928afe4e682d696d..4ce99945acbd4c0fb4fd0ba1689ad0ae4b983b90 100644 (file)
@@ -651,9 +651,8 @@ As a part of this process, after performing the initial transform
     `<html:head>` of the output.
 
 The document being matched will contain the full transform result
     `<html:head>` of the output.
 
 The document being matched will contain the full transform result
-  prior to wrapping as well as an `<xslt:include>` element (with an
-  `@书社:id` attribute) for each transform which has a valid
-  `<书社:id>`.
+  prior to wrapping as well as an `<书社:id>` element for each
+  transform.
 The latter elements can be matched to enable transforms to provide
   content _without_ matching any elements in the result; for example,
   the following transform adds a link to a stylesheet to the
 The latter elements can be matched to enable transforms to provide
   content _without_ matching any elements in the result; for example,
   the following transform adds a link to a stylesheet to the
@@ -670,7 +669,7 @@ The latter elements can be matched to enable transforms to provide
   version="1.0"
 >
   <书社:id>example:add-stylesheet-links.xslt</书社:id>
   version="1.0"
 >
   <书社:id>example:add-stylesheet-links.xslt</书社:id>
-  <template match="xslt:include[@书社:id='example:add-stylesheet-links.xslt']" mode="书社:metadata">
+  <template match="书社:id[string(.)='example:add-stylesheet-links.xslt']" mode="书社:metadata">
     <html:link rel="stylesheet" type="text/css" href="/style.css"/>
   </template>
 </transform>
     <html:link rel="stylesheet" type="text/css" href="/style.css"/>
   </template>
 </transform>
index 74f7f46b4edf3fdc5f78502664f7584ae58b9941..5098a2cdd38b92d5cc61f587e680cf3a009ad9ee 100644 (file)
@@ -36,6 +36,20 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
        <param name="METADATA" select="'about:blank'"/>
        <template match="/">
        <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
        <param name="METADATA" select="'about:blank'"/>
        <template match="/">
+               <variable name="ids">
+                       <for-each select="//catalog:uri[@name]">
+                               <书社:id>
+                                       <value-of select="@name"/>
+                               </书社:id>
+                       </for-each>
+               </variable>
+               <variable name="unique-ids">
+                       <for-each select="exsl:node-set($ids)/*">
+                               <if test="not(preceding-sibling::*[string(.)=string(current())])">
+                                       <copy-of select="."/>
+                               </if>
+                       </for-each>
+               </variable>
                <xslt:transform exclude-result-prefixes="nie nfo" extension-element-prefixes="exsl exslstr" version="1.0">
                        <xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
                        <xslt:param name="IDENTIFIER" select="false()"/>
                <xslt:transform exclude-result-prefixes="nie nfo" extension-element-prefixes="exsl exslstr" version="1.0">
                        <xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
                        <xslt:param name="IDENTIFIER" select="false()"/>
@@ -72,11 +86,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        </xslt:variable>
                        <for-each select="//catalog:uri">
                                <xslt:include href="{@uri}">
                        </xslt:variable>
                        <for-each select="//catalog:uri">
                                <xslt:include href="{@uri}">
-                                       <if test="contains(@name, ':')">
-                                               <attribute name="书社:id">
-                                                       <value-of select="@name"/>
-                                               </attribute>
-                                       </if>
+                                       <attribute name="书社:id">
+                                               <value-of select="@name"/>
+                                       </attribute>
                                </xslt:include>
                        </for-each>
                        <xslt:template name="书社:apply-attributes">
                                </xslt:include>
                        </for-each>
                        <xslt:template name="书社:apply-attributes">
@@ -192,7 +204,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                <xslt:param name="nodes" select="/.."/>
                                <xslt:variable name="modalinput-fragment">
                                        <xslt:copy-of select="$nodes"/>
                                <xslt:param name="nodes" select="/.."/>
                                <xslt:variable name="modalinput-fragment">
                                        <xslt:copy-of select="$nodes"/>
-                                       <xslt:copy-of select="document('')/xslt:transform/xslt:include"/>
+                                       <apply-templates select="exsl:node-set($unique-ids)" mode="书社:literally"/>
                                </xslt:variable>
                                <xslt:variable name="modalinput" select="exsl:node-set($modalinput-fragment)"/>
                                <xslt:variable name="metadata-fragment">
                                </xslt:variable>
                                <xslt:variable name="modalinput" select="exsl:node-set($modalinput-fragment)"/>
                                <xslt:variable name="metadata-fragment">
index 02cba0333e1828cae3140c09089a0338bdfca96a..8ed07c4c56068ff5c3bd5b7619a1be85045e0d13 100644 (file)
@@ -15,7 +15,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:exsl="http://exslt.org/common"
        xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:exsl="http://exslt.org/common"
        xmlns:html="http://www.w3.org/1999/xhtml"
-       xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        extension-element-prefixes="exsl"
        version="1.0"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        extension-element-prefixes="exsl"
        version="1.0"
@@ -42,7 +41,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        <copy-of select="@书社:identifier"/>
                </html:video>
        </template>
                        <copy-of select="@书社:identifier"/>
                </html:video>
        </template>
-       <template match="xslt:include[@书社:id='urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt']" mode="书社:metadata">
+       <template match="书社:id[string(.)='urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt']" mode="书社:metadata">
                <for-each select="$书社:expansion//html:object[@type='text/css']">
                        <html:link rel="stylesheet" type="text/css" href="{@data}">
                                <copy-of select="@书社:identifier"/>
                <for-each select="$书社:expansion//html:object[@type='text/css']">
                        <html:link rel="stylesheet" type="text/css" href="{@data}">
                                <copy-of select="@书社:identifier"/>
This page took 0.027527 seconds and 4 git commands to generate.