SXLM0001: Too many nested apply-templates cal
Added by Anonymous about 16 years ago
Legacy ID: #5630163 Legacy Poster: Willem van Heerde (wheerde)
Hello Michael, I am getting the following error (I am using 9.1.0.3j): Error at xsl:apply-templates on line 4116 of xslt-xml-schema.xsl: SXLM0001: Too many nested apply-templates calls. The stylesheet may be looping. at xsl:apply-templates (file:/home/wheerde/xsd/xslt-xml-schema.xsl#4109) processing /xs:schema/xsd:group[1]/xsd:choice[1] at xsl:apply-templates (file:/home/wheerde/xsd/xslt-xml-schema.xsl#4116) processing /xs:schema/xsd:group[1]/xsd:choice[1]/xsd:group[1] at xsl:apply-templates (file:/home/wheerde/xsd/xslt-xml-schema.xsl#4109) processing /xs:schema/xsd:group[1]/xsd:choice[1] at xsl:apply-templates (file:/home/wheerde/xsd/xslt-xml-schema.xsl#4116) ............etc etc etc............... My xslt program worked fine unbtil I added another template. I do not understand the message because I do not use deep nested templates and the program is not looping. The program is no looping because the nested template was already executed. The structure of the program contains a lot of steps like: <xsl:variable name="var1"> <xsl:choose> <xsl:when test="$var0//error"> <xsl:copy-of select="$var0"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates mode="mode1" select="$var1"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="$trace and not($var0//error)"> <bebug-1><xsl:copy-of select="$var1"/></debug-1> </xsl:if> <xsl:variable name="var2"> <xsl:choose> <xsl:when test="$var1//error"> <xsl:copy-of select="$var1"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates mode="mode2" select="$var2"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="$trace and not($var1//error)"> <bebug-2><xsl:copy-of select="$var2"/></debug-2> </xsl:if> <xsl:variable name="var3"> etc etc etc................... As you can see the templates are not nested. When I remove one of the steps the program works fine so I think some limit is reached. Can you help me on this one because I still have to add a lot more osteps in the future. Already thanx, Willem./
Replies (3)
Please register to reply
RE: SXLM0001: Too many nested apply-templates - Added by Anonymous about 16 years ago
Legacy ID: #5630369 Legacy Poster: Willem van Heerde (wheerde)
Hi, Some extra info. The problem occurs when I try in a template to access elements from the root: <xsl:template mode="xxxxxxx" match="element"> <xsl:variable name="cur" select="/top"/> ......... When I do (this is not correct for my program but only for demo): <xsl:template mode="xxxxxxx" match="element"> <xsl:variable name="cur" select="top"/> ........... the program does not give an error. Willem.
RE: SXLM0001: Too many nested apply-templates - Added by Anonymous about 16 years ago
Legacy ID: #5630522 Legacy Poster: Michael Kay (mhkay)
The stack trace shows that at line 4109 of your code you have an xsl:apply-templates call which is processing an xsd:choice element and selects its child xsd:group element. The xsd:group element is processed by a template rule at line 4116 which contains an apply-templates call which in turn processes the parent xsd:choice element; this invokes the original template at line 4109, and the cycle continues indefinitely. It really isn't my job to debug your code for you. But if you want help in debugging your code, you will need to let me see your code. I'm not looking forward to the prospect given that it is over 4000 lines long, but it looks to me as if the error you are making is a fairly simple one so perhaps it won't take me long. Showing small snippets of your code doesn't help at all.
RE: SXLM0001: Too many nested apply-templates - Added by Anonymous about 16 years ago
Legacy ID: #5630794 Legacy Poster: Willem van Heerde (wheerde)
Hello Michael, I found the bug in my xslt-code. I overlooked it completely, but after your explanation I saw what was going on. Thanx for the help! Willem.
Please register to reply