[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsltproc -maxdepth

Subject: Re: xsltproc -maxdepth
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 2 Jun 2015 12:20:35 -0000
Re:  xsltproc -maxdepth
Heinrich Nbongo heinrich_nbongo@xxxxxxxxxxx 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.