:. , , , , . selection [ ], . [ , , , <xsl:copy-of select="$country"/>, .]
, :
<xsl:apply-template select="address/country"/>
[...]
<xsl:template match="address/country">
<h1><xsl:value-of select="."/></h1>
<p><xsl:value-of select="."/></p>
[...]
</xsl:template>
@Mathias_MΓΌller , "... ...", . XSLT 2.0 for-each:
<xsl:for-each select="1 to 100">
<p><xsl:value-of select="."/></p>
</xsl:for-each>
XSLT >= 2.0, , call-template [ ]:
<xsl:call-template name="ntimes">
<xsl:with-param name="counter" select="100"/>
</xsl:call-template>
[...]
<xsl:template name="ntimes">
<xsl:param name="counter" select="0"/>
<xsl:if test="$counter > 0">
<xsl:choose>
<xsl:when test="$counter = 1">
<xsl:apply-template select="address/country"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="half" select="floor($counter div 2)"/>
<xsl:call-template name="ntimes">
<xsl:with-param name="counter" select="$half"/>
</xsl:call-template>
<xsl:call-template name="ntimes">
<xsl:with-param name="counter" select="$counter - $half"/>
</xsl:call-template>
[...]
.
Honestly, I don't know anything about performance and optimization in XSLT. I never thought it was worth the effort, given that most of the time I use XSLT processors written in Java and that I use large input files, while theres still whole, several hundred MB of RAM. consuming jvm to run up to ..?
source
share