syntax of apply-template in xml stylesheet

sfaa

New Member
there is a variable named "this-article" in the following code.Generally, We use "xsl:apply-templates" in this way\[code\]<xsl:apply-templates select="somenode"/>\[/code\]"somenode" means a child node.but in this variable , apply-template was written in this way. it is strange.\[code\] <xsl:apply-templates select="." mode="id"/>\[/code\]I would appreciate if you explain the meaning of it.\[code\]<!-- ============================================================= --><!-- "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>\[/code\]
 
Back
Top