我正在研究一个递归循环。下面是示例代码。
循环只执行一次。它在达到最大计数(20 次)之前不会执行。
如果这是一个问题,你能帮忙吗?
谢谢,拉吉
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:xdoxslt='http://www.oracle.com/XSL/Transform/java/oracle.apps.xdo.template.rtf.XSLTFunctions'>
<xsl:output method="text" omit-xml-declaration="yes" />
<xsl:variable name="nl">
<xsl:value-of select="'
'"/>
<xsl:text xml:space="preserve"> </xsl:text>
</xsl:variable>
<xsl:template match = "ARCHIVE_CHEQUE_WRITER">
<xsl:for-each select="CHEQUE">
<xsl:variable name="ded" select="./AC_DEDUCTIONS"/>
<xsl:variable name="dedcount" select="count($ded)"/>
<xsl:variable name="earn" select="./AC_EARNINGS"/>
<xsl:variable name="earncount" select="count($earn)"/>
<xsl:value-of select="$dedcount"/>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$earncount"/>
<xsl:value-of select="$nl"/>
<xsl:text>Starting New Record*******</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:for-each select="./AC_DEDUCTIONS">
<xsl:text>This is sample template</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:for-each>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$nl"/>
<xsl:call-template name="recursive-loop">
<xsl:with-param name="pCount" select="20"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="recursive-loop">
<xsl:param name="pStart" select="1"/>
<xsl:param name="pCount"/>
<xsl:text> value of parameters</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:value-of select="$pStart"/>
<xsl:value-of select="$pCount"/>
<xsl:value-of select="$nl"/>
<xsl:if test="$pCount > pStart">
<xsl:call-template name="recursive-loop">
<xsl:with-param name="pStart" select="$pStart+1"/>
<xsl:with-param name="pCount" select="$pCount"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>