]> Lady’s Gitweb - Shushe/blobdiff - lib/catalog2transform.xslt
Provide template identifiers as <书社:id>s
[Shushe] / lib / catalog2transform.xslt
index af7fd6fc87e25bc787b0fbb27743b409c4338dc8..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()"/>
@@ -44,7 +58,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        <xslt:param name="THISREV" select="false()"/>
                        <xslt:variable name="书社:source" select="/"/>
                        <xslt:variable name="书社:about-fragment">
-                               <apply-templates select="document($METADATA)" mode="书社:literally"/>
+                               <apply-templates select="document($METADATA)" mode="书社:literally">
+                                       <with-param name="extension-element-namespaces" select="'http://exslt.org/common http://exslt.org/strings'"/>
+                               </apply-templates>
                        </xslt:variable>
                        <xslt:variable name="书社:about" select="exsl:node-set($书社:about-fragment)"/>
                        <xslt:variable name="书社:expansion-fragment">
@@ -70,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">
@@ -190,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">
@@ -263,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.023927 seconds and 4 git commands to generate.