]> Lady’s Gitweb - Shushe/blobdiff - lib/catalog2transform.xslt
Provide template identifiers as <书社:id>s
[Shushe] / lib / catalog2transform.xslt
index 6479216fb915a8439b5194ba306bfa741ec66dc2..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="/">
+               <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()"/>
@@ -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}">
-                                       <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">
@@ -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: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">
@@ -265,7 +277,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                <xslt:variable name="result-nodes" select="$书社:result/node()[not(self::书社:apply-attributes-to-root)]|$书社:result/书社:apply-attributes-to-root/descendant::node()[not(self::书社:apply-attributes-to-root) and not(ancestor::*[not(self::书社:apply-attributes-to-root)])]"/>
                                <xslt:variable name="root-with-attributes">
                                        <xslt:choose>
-                                               <xslt:when test="$result-nodes/self::书社:*[local-name()='raw-text' or local-name()='base64-binary' or local-name()='archive']|$result-nodes/@书社:disable-output-wrapping|$书社:result//书社:apply-attributes-to-root/@书社:disable-output-wrapping">
+                                               <xslt:when test="not($result-nodes/self::html:*) or $result-nodes/self::书社:*[local-name()='raw-text' or local-name()='base64-binary' or local-name()='archive'] or $result-nodes/@书社:disable-output-wrapping or $书社:result//书社:apply-attributes-to-root/@书社:disable-output-wrapping">
                                                        <xslt:call-template name="书社:apply-attributes">
                                                                <xslt:with-param name="and-version" select="true()"/>
                                                                <xslt:with-param name="context-nodes" select="$书社:result//书社:apply-attributes-to-root"/>
This page took 0.023085 seconds and 4 git commands to generate.