Re: [xslt] [lxml-dev] XSLT - xsltMaxDepth setting



On Thu, Nov 04, 2010 at 08:42:01AM -0400, Jérôme Carretero wrote:
> On Mon, 01 Nov 2010 17:14:30 +0100
> Stefan Behnel <stefan_ml behnel de> wrote:
> 
> > Jérôme Carretero, 01.11.2010 13:38:
> > > libxslt uses a xsltMaxDepth variable (global...) to limit recursion,
> > >   and I used to increase it when processing some big files (for instance, DocBook containing tables spanning over dozens of pages).
> > > xsltproc --maxdepth 10000 ....
> > >
> > > At the moment, lxml does not touch this value.
> > >
> > > Maybe providing a lxml.etree.XSLT.maxdepth property would not be too complicated ?
> > 
> > Such a local property doesn't work well for a global setting, and global 
> > settings are always evil. Isn't there a per-call setting for this?
> 
> Attached is a libxslt patch that makes the max template depth an attribute of the transform context and not a global variable.
> 
> Comments ?
[...]
> --- a/libxslt/xslt.h
> +++ b/libxslt/xslt.h
> @@ -55,13 +55,6 @@ extern "C" {
>   XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA
>  
>  /**
> - * xsltMaxDepth:
> - *
> - * This value is used to detect templates loops.
> - */
> -XSLTPUBVAR int xsltMaxDepth;

  That is not possible, it's a public variable, we can't remove it
it breaks API and ABI if we do.
  I'm not sure that adding a second global variable will help
On the other hand a call allowing to set those
  +       int maxTemplateDepth;
  +       int maxTemplateVars;
in a given transformation context is fine by me. I.e. the patch is
good in general, but intialization should still be done with
xsltMaxDepth, but provide a call allowing to set up new values
for a transformation context (not strictly needed since it a global
structure, but it's cleaner).

Daniel


-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]