+ <element name="exslfunc:result">
+ <attribute name="select">
+ <text>exsl:node-set($application-result-fragment)</text>
+ </attribute>
+ </element>
+ </element>
+ <xslt:variable name="书社:source" select="/"/>
+ <xslt:variable name="书社:about-fragment">
+ <apply-templates select="document($METADATA)" mode="书社:literally">
+ <with-param name="extension-element-namespaces" select="'http://exslt.org/common http://exslt.org/functions http://exslt.org/strings'"/>
+ </apply-templates>
+ </xslt:variable>
+ <xslt:variable name="书社:about" select="exsl:node-set($书社:about-fragment)"/>
+ <xslt:variable name="书社:expansion-fragment">
+ <xslt:apply-templates select="$书社:source/node()" mode="书社:expand"/>
+ </xslt:variable>
+ <xslt:variable name="书社:expansion" select="书社:document-with-attributes-applied(exsl:node-set($书社:expansion-fragment))"/>
+ <xslt:variable name="书社:result-fragment">
+ <xslt:apply-templates select="$书社:expansion/node()"/>
+ </xslt:variable>
+ <xslt:variable name="书社:result" select="书社:document-with-attributes-applied(exsl:node-set($书社:result-fragment))"/>
+ <xslt:variable name="书社:destination" select="string($书社:about//*[@rdf:about=$IDENTIFIER]/@书社vocab:destination)"/>
+ <for-each select="//catalog:uri">
+ <xslt:include href="{@uri}">
+ <attribute name="书社:id">
+ <value-of select="@name"/>
+ </attribute>
+ </xslt:include>
+ </for-each>
+ <xslt:template name="书社:apply-attributes">
+ <xslt:param name="and-version" select="false()"/>
+ <xslt:param name="context-nodes" select="/.."/>
+ <xslt:param name="destination-nodes" select="/.."/>
+ <xslt:variable name="additional-attributes" select="$context-nodes/@*"/>
+ <xslt:for-each select="$destination-nodes">
+ <xslt:variable name="existing-attributes" select="@*"/>
+ <xslt:choose>
+ <xslt:when test="self::*">
+ <xslt:variable name="context" select="."/>
+ <xslt:variable name="attribute-names">
+ <xslt:for-each select="$existing-attributes|$additional-attributes">
+ <书社:attribute>
+ <attribute name="local-name">
+ <text>{local-name()}</text>
+ </attribute>
+ <attribute name="name">
+ <text>{name()}</text>
+ </attribute>
+ <attribute name="namespace-uri">
+ <text>{namespace-uri()}</text>
+ </attribute>
+ </书社:attribute>
+ </xslt:for-each>
+ </xslt:variable>
+ <xslt:variable name="lang">
+ <xslt:choose>
+ <xslt:when test="(self::html:*|self::svg:*)/@lang">
+ <xslt:value-of select="@lang"/>
+ </xslt:when>
+ <xslt:when test="@xml:lang">
+ <xslt:value-of select="@xml:lang"/>
+ </xslt:when>
+ <xslt:when test="$additional-attributes[(parent::html:* or parent::svg:*) and namespace-uri()='' and local-name()='lang']">
+ <xslt:value-of select="$additional-attributes[(parent::html:* or parent::svg:*) and namespace-uri()='' and local-name()='lang']"/>
+ </xslt:when>
+ <xslt:when test="(self::html:* or self::svg:*) and $additional-attributes[(parent::书社:apply-attributes or parent::书社:apply-attributes-to-root) and namespace-uri()='' and local-name()='lang']">
+ <xslt:value-of select="$additional-attributes[(parent::书社:apply-attributes or parent::书社:apply-attributes-to-root) and namespace-uri()='' and local-name()='lang']"/>
+ </xslt:when>
+ <xslt:when test="$additional-attributes[namespace-uri()='&xml;' and local-name()='lang']">
+ <xslt:value-of select="$additional-attributes[namespace-uri()='&xml;' and local-name()='lang']"/>
+ </xslt:when>
+ </xslt:choose>
+ </xslt:variable>
+ <xslt:copy>
+ <xslt:if test="$and-version and $THISREV">
+ <xslt:attribute name="书社:version">
+ <xslt:value-of select="$THISREV"/>
+ </xslt:attribute>
+ </xslt:if>
+ <xslt:if test="string($lang)!=''">
+ <xslt:if test="self::html:* or self::svg:*">
+ <xslt:attribute name="lang">
+ <xslt:value-of select="$lang"/>
+ </xslt:attribute>
+ </xslt:if>
+ <xslt:attribute name="xml:lang">
+ <xslt:value-of select="$lang"/>
+ </xslt:attribute>
+ </xslt:if>
+ <xslt:for-each select="exsl:node-set($attribute-names)/*">
+ <xslt:choose>
+ <xslt:when test="@namespace-uri='&xml;'"/>
+ <xslt:when test="$context[self::html:* or self::svg:*] and @namespace-uri='' and @local-name='lang'"/>
+ <xslt:when test="$and-version and $THISREV and @namespace-uri='&书社;' and @local-name='version'"/>
+ <xslt:when test="@namespace-uri='&书社;' and (@local-name='destination' or @local-name='disable-output-wrapping')"/>
+ <xslt:when test="preceding-sibling::*[@local-name=current()/@local-name and @namespace-uri=current()/@namespace-uri]"/>
+ <xslt:otherwise>
+ <xslt:attribute>
+ <attribute name="name">
+ <text>{@name}</text>
+ </attribute>
+ <attribute name="namespace">
+ <text>{@namespace-uri}</text>
+ </attribute>
+ <xslt:for-each select="$existing-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri]">
+ <xslt:value-of select="."/>
+ <xslt:if test="position()!=last()">
+ <xslt:text>
+ <text> </text>
+ </xslt:text>
+ </xslt:if>
+ </xslt:for-each>
+ <xslt:if test="$existing-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri] and $additional-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri]">
+ <xslt:text>
+ <text> </text>
+ </xslt:text>
+ </xslt:if>
+ <xslt:for-each select="$additional-attributes[local-name()=current()/@local-name and namespace-uri()=current()/@namespace-uri]">
+ <xslt:value-of select="."/>
+ <xslt:if test="position()!=last()">
+ <xslt:text>
+ <text> </text>
+ </xslt:text>
+ </xslt:if>
+ </xslt:for-each>
+ </xslt:attribute>
+ </xslt:otherwise>
+ </xslt:choose>
+ </xslt:for-each>
+ <xslt:copy-of select="node()"/>
+ </xslt:copy>
+ </xslt:when>
+ <xslt:otherwise>
+ <xslt:copy-of select="."/>
+ </xslt:otherwise>
+ </xslt:choose>
+ </xslt:for-each>
+ </xslt:template>
+ <xslt:template name="书社:wrap">
+ <xslt:param name="nodes" select="/.."/>
+ <xslt:variable name="modalinput-fragment">
+ <xslt:copy-of select="$nodes"/>
+ <apply-templates select="exsl:node-set($unique-ids)" mode="书社:literally"/>