<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: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">
</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: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 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"/>