1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-07-09 03:41:46 +03:00

Allow per-context override of xsltMaxDepth, introduce xsltMaxVars

We also add a maxTemplateVars parameter
This commit is contained in:
Jérôme Carretero
2012-03-19 15:06:53 +08:00
committed by Daniel Veillard
parent a2e32666e0
commit adff7c36bd
12 changed files with 54 additions and 4 deletions

View File

@ -466,6 +466,9 @@ xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) {
if (xinclude)
ctxt->xinclude = 1;
#endif
ctxt->maxTemplateDepth = xsltMaxDepth;
ctxt->maxTemplateVars = xsltMaxVars;
if (profile) {
ret = xsltRunStylesheetUser(cur, doc, params, output,
NULL, NULL, stderr, ctxt);
@ -501,7 +504,8 @@ static void usage(const char *name) {
printf("\t--novalid skip the DTD loading phase\n");
printf("\t--nodtdattr do not default attributes from the DTD\n");
printf("\t--noout: do not dump the result\n");
printf("\t--maxdepth val : increase the maximum depth\n");
printf("\t--maxdepth val : increase the maximum depth (default %d)\n", xsltMaxDepth);
printf("\t--maxvars val : increase the maximum variables (default %d)\n", xsltMaxVars);
printf("\t--maxparserdepth val : increase the maximum parser depth\n");
#ifdef LIBXML_HTML_ENABLED
printf("\t--html: the input document is(are) an HTML file(s)\n");
@ -721,6 +725,15 @@ main(int argc, char **argv)
if (value > 0)
xsltMaxDepth = value;
}
} else if ((!strcmp(argv[i], "-maxvars")) ||
(!strcmp(argv[i], "--maxvars"))) {
int value;
i++;
if (sscanf(argv[i], "%d", &value) == 1) {
if (value > 0)
xsltMaxVars = value;
}
} else if ((!strcmp(argv[i], "-maxparserdepth")) ||
(!strcmp(argv[i], "--maxparserdepth"))) {
int value;