summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
3b97090)
When matching a `<xslt:include>` inside of a `书社:metadata` transform,
it’s useful to be able to easily match elements in the result. Right
now, that requires a reference to the little‐documented variable
`$书社:result`, because `<xslt:include>` elements don’t belong to the
same document as result tree elements.
This commit creates a new tree which simply copies over all the result
nodes and all of the `<xslt:include>` elements, and then passes that to
the modal templates. Consequently, matches like `/html:div` or
`/xslt:include` should work regardless of what the current context node
is.
<xslt:template match="text()" mode="书社:footer"/>
<xslt:template match="text()" mode="书社:metadata"/>
<xslt:template match="/" mode="书社:wrap">
<xslt:template match="text()" mode="书社:footer"/>
<xslt:template match="text()" mode="书社:metadata"/>
<xslt:template match="/" mode="书社:wrap">
+ <xslt:variable name="modalinput">
+ <xslt:copy-of select="node()"/>
+ <xslt:copy-of select="document('')/xslt:transform/xslt:include"/>
+ </xslt:variable>
<xslt:variable name="metadata">
<xslt:copy-of select="html:html/html:head/node()|html:head/node()"/>
<xslt:variable name="metadata">
<xslt:copy-of select="html:html/html:head/node()|html:head/node()"/>
- <xslt:apply-templates select="." mode="书社:metadata"/>
- <xslt:apply-templates select="document('')/xslt:transform/xslt:include" mode="书社:metadata"/>
+ <xslt:apply-templates select="exsl:node-set($modalinput)" mode="书社:metadata"/>
</xslt:variable>
<html:html>
<xslt:if test="$VERSION">
</xslt:variable>
<html:html>
<xslt:if test="$VERSION">
</html:head>
<html:body>
<xslt:copy-of select="html:html/html:body/@*|html:body/@*"/>
</html:head>
<html:body>
<xslt:copy-of select="html:html/html:body/@*|html:body/@*"/>
- <xslt:apply-templates select="document('')/xslt:transform/xslt:include" mode="书社:header"/>
- <xslt:apply-templates select="." mode="书社:header"/>
+ <xslt:apply-templates select="exsl:node-set($modalinput)" mode="书社:header"/>
<xslt:copy-of select="node()[not(self::html:html or self::html:head or self::html:body)]|html:html/node()[not(self::html:head or self::html:body)]|html:html/html:body/node()|html:body/node()"/>
<xslt:copy-of select="node()[not(self::html:html or self::html:head or self::html:body)]|html:html/node()[not(self::html:head or self::html:body)]|html:html/html:body/node()|html:body/node()"/>
- <xslt:apply-templates select="." mode="书社:footer"/>
- <xslt:apply-templates select="document('')/xslt:transform/xslt:include" mode="书社:footer"/>
+ <xslt:apply-templates select="exsl:node-set($modalinput)" mode="书社:footer"/>
</html:body>
</html:html>
</xslt:template>
</html:body>
</html:html>
</xslt:template>