Heinrich Nbongo heinrich_nbongo(_at_)hotmail(_dot_)com wrote:
I admit, haven't dealt with xslt for a long time. However, I bumped into
this option "xsltproc -maxdepth", and couldn't find a sufficient
information of what exactly it controls ("max. template stack depth" -
which doesn't mean nothing to me). Could any provide me with more info
of which problem is solves (ok, max nr of recursion, but recursion of
what exactly?) , and how exactly it has been solved.
Think of apply-templates as a recursive method or function call. For
instance with the input being
<root>
<section>
<division>
<division>
<division>
<division>This is a test.</division>
</division>
</division>
</division>
</section>
</root>
the stylesheet
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="root">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="section">
<body>
<xsl:apply-templates/>
</body>
</xsl:template>
<xsl:template match="division">
<div>
<xsl:apply-templates/>
</div>
</xsl:template>
</xsl:stylesheet>
outputs
<html>
<body>
<div>
<div>
<div>
<div>This is a test.</div>
</div>
</div>
</div>
</body>
</html>
Now when I intentionally set --maxdepth 5 xsltproc aborts the
transformation with an error message
xsltApplyXSLTTemplate: A potential infinite template recursion was detected.
You can adjust xsltMaxDepth (--maxdepth) in order to raise the maximum
number of nested template calls and variables/par
ams (currently set to 5).
Templates:
#0 name division
#1 name division
#2 name division
#3 name section
#4 name root
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--