+ <xslt:template match="@书社:destination[not(../self::书社:page)]|@书社:disable-output-wrapping|@书社:archived-as[../ancestor::*[not(self::书社:apply-attributes-to-root or self::书社:apply-attributes)]]" mode="书社:application" priority="1"/>
+ <xslt:template match="书社:archive|书社:page" mode="书社:application" priority="1">
+ <xslt:copy>
+ <xslt:for-each select="@*">
+ <xslt:choose>
+ <xslt:when test="../self::书社:archive and local-name()='archived-as' and namespace-uri()='&书社;' and ../ancestor::*[not(self::书社:apply-attributes-to-root or self::书社:apply-attributes)]"/>
+ <xslt:otherwise>
+ <xslt:apply-templates select="." mode="书社:application"/>
+ </xslt:otherwise>
+ </xslt:choose>
+ </xslt:for-each>
+ <xslt:if test="self::书社:page and not(@书社:destination)">
+ <xslt:attribute name="书社:destination">
+ <xslt:value-of select="substring-before($书社:pagedestination, '%s')"/>
+ <xslt:text>%22%7B</xslt:text>
+ <xslt:choose>
+ <xslt:when test="@name">
+ <xslt:value-of select="@name"/>
+ </xslt:when>
+ <xslt:otherwise>
+ <xslt:value-of select="count(ancestor::书社:page|preceding::书社:page)+1"/>
+ </xslt:otherwise>
+ </xslt:choose>
+ <xslt:text>%7D%22</xslt:text>
+ <xslt:value-of select="substring-after($书社:pagedestination, '%s')"/>
+ </xslt:attribute>
+ </xslt:if>
+ <xslt:for-each select="node()">
+ <xslt:choose>
+ <xslt:when test="self::*">
+ <xslt:variable name="component">
+ <xslt:choose>
+ <xslt:when test="self::书社:*[local-name()='raw-text' or local-name()='base64-binary' or local-name()='archive']|@书社:disable-output-wrapping">
+ <xslt:copy-of select="."/>
+ </xslt:when>
+ <xslt:otherwise>
+ <xslt:call-template name="书社:wrap">
+ <xslt:with-param name="nodes" select="."/>
+ </xslt:call-template>
+ </xslt:otherwise>
+ </xslt:choose>
+ </xslt:variable>
+ <xslt:apply-templates select="exsl:node-set($component)/node()" mode="书社:application"/>
+ </xslt:when>
+ <xslt:otherwise>
+ <xslt:apply-templates select="." mode="书社:application"/>
+ </xslt:otherwise>
+ </xslt:choose>
+ </xslt:for-each>
+ </xslt:copy>
+ </xslt:template>