+                       <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="@namespace-uri='&书社;' and (@local-name='destination' or @local-name='disable-output-wrapping' or @local-name='version')"/>
+                                                                               <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">
+                                       <xslt:copy-of select="$nodes"/>
+                                       <xslt:copy-of select="document('')/xslt:transform/xslt:include"/>