summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Weibull <now@disu.se>2019-10-28 09:10:35 +0100
committerDaniel Veillard <veillard@redhat.com>2019-10-28 09:10:35 +0100
commite3577d4897677d775e6c48d5172089fade95b886 (patch)
tree2e8f1d9a61c7477ba66c57a25e8982e05a681fc7
parente9709fa901ef82067f655841dbc257ebac2c4782 (diff)
downloadlibxslt-1.1.34-rc2.tar.gz
xsl:template without name and match attributes should not be allowedv1.1.34-rc2
libxslt allows for an xsl:template to be created without name or match attribute. This isn’t allowed by the standard and sometimes my colleagues forget and then wonder why things don’t work :-). A simple check in xsltAddTemplate would suffice, for example,
-rw-r--r--libxslt/pattern.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index 8e4cd4a2..c6496732 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -2156,8 +2156,15 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur,
xmlHashAddEntry2(style->namedTemplates, cur->name, cur->nameURI, cur);
}
- if (cur->match == NULL)
+ if (cur->match == NULL) {
+ if (cur->name == NULL) {
+ xsltTransformError(NULL, style, cur->elem,
+ "xsl:template: need to specify match or name attribute\n");
+ style->errors++;
+ return(-1);
+ }
return(0);
+ }
priority = cur->priority;
pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,