以下代码中有一个名为“this-article”的变量。
一般我们都是这样使用“xsl:apply-templates”的
<xsl:apply-templates select="somenode"/>
“somenode”表示子节点。
但是在这个变量中,apply-template 是这样写的。它很奇怪。
<xsl:apply-templates select="." mode="id"/>
如果您能解释它的含义,我将不胜感激。
<!-- ============================================================= -->
<!-- "make-article" for the document architecture -->
<!-- ============================================================= -->
<xsl:template name="make-article">
<!-- Generates a series of (flattened) divs for contents of any
article, sub-article or response -->
<!-- variable to be used in div id's to keep them unique -->
<xsl:variable name="this-article">
<xsl:apply-templates select="." mode="id"/>
</xsl:variable>
<div id="{$this-article}-front" class="front">
<xsl:apply-templates select="front | front-stub"/>
</div>
<!-- body -->
<xsl:for-each select="body">
<div id="{$this-article}-body" class="body">
<xsl:apply-templates/>
</div>
</xsl:for-each>
<xsl:if test="back | $loose-footnotes">
<!-- $loose-footnotes is defined below as any footnotes outside
front matter or fn-group -->
<div id="{$this-article}-back" class="back">
<xsl:call-template name="make-back"/>
</div>
</xsl:if>
<xsl:for-each select="floats-group">
<div id="{$this-article}-floats" class="back">
<xsl:call-template name="main-title">
<xsl:with-param name="contents">
<span class="generated">Floating objects</span>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</div>
</xsl:for-each>
<!-- more metadata goes in the footer -->
<div id="{$this-article}-footer" class="footer">
<xsl:call-template name="footer-metadata"/>
<xsl:call-template name="footer-branding"/>
</div>
<!-- sub-article or response (recursively calls
this template) -->
<xsl:apply-templates select="sub-article | response"/>
</xsl:template>