- <xslt:variable name="expansion">
- <xslt:apply-templates select="." mode="书社:expand"/>
- </xslt:variable>
- <xslt:variable name="result">
- <xslt:apply-templates select="exsl:node-set($expansion)/*"/>
- </xslt:variable>
- <xslt:variable name="metadata">
- <xslt:copy-of select="exsl:node-set($result)/html/head/*"/>
- <xslt:apply-templates select="exsl:node-set($result)" mode="书社:metadata"/>
- </xslt:variable>
- <html:html>
- <xslt:copy-of select="exsl:node-set($result)/html:html/@*"/>
- <html:head>
- <xslt:copy-of select="exsl:node-set($result)/html:html/html:head/@*"/>
- <html:title>
- <xslt:for-each select="exsl:node-set($metadata)/html:title">
- <xslt:value-of select="."/>
- </xslt:for-each>
- </html:title>
- <xslt:copy-of select="exsl:node-set($metadata)/*[not(self::html:title)]"/>
- <xslt:if test="not(exsl:node-set($metadata)/html:meta[@name='generator'])">
- <html:meta name="generator" content="⛩️📰 书社"/>
- </xslt:if>
- </html:head>
- <html:body>
- <xslt:copy-of select="exsl:node-set($result)/*[not(self::html:html or self::html:body)]|exsl:node-set($result)/html:html/*[not(self::html:head or self::html:body)]|exsl:node-set($result)/html:html/html:body/*|exsl:node-set($result)/html:body/*"/>
- </html:body>
- </html:html>
+ <xslt:choose>
+ <xslt:when test="exsl:node-set($书社:result)/*[@书社:disable-output-wrapping]">
+ <xslt:for-each select="exsl:node-set($书社:result)/*">
+ <xslt:copy>
+ <xslt:copy-of select="@*[not(namespace-uri()='&书社;' and local-name()='disable-output-wrapping')]|node()"/>
+ </xslt:copy>
+ </xslt:for-each>
+ </xslt:when>
+ <xslt:otherwise>
+ <xslt:apply-templates select="exsl:node-set($书社:result)" mode="书社:wrap"/>
+ </xslt:otherwise>
+ </xslt:choose>