pub const fn max_nesting_for_depth(max_depth: u32) -> u32Expand description
The nesting of template and function invocations the stylesheets are allowed on a
document at most max_depth deep (ValidateOptions::max_depth): twice the depth,
plus 64. Each level needs less than 3 KiB of stack (debug builds included), which is
what a caller raising the maximum depth must give the validating thread.
The nesting of invocations that the official stylesheets need on a document
max_depth deep, with room to spare: twice the depth, plus 64.
A compiled Schematron applies the template rules of each pattern to every element, one
element level inside another, so the nesting reaches the depth of the document; where
a rule fires, the ISO Schematron skeleton writes the location of the node with a
template that recurses over its ancestors (mode schematron-get-full-path), which
nests as deep again. The 64 levels above are for the few invocations around them
(the root template, the next rule in a chain) and for stylesheets that recurse
otherwise. On a document DEFAULT_MAX_DEPTH deep, this nesting fits in the 2 MiB
stack a thread is given by default, in a debug build too.