mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-07 10:42:55 +03:00
Allow {URI}NCName syntax for user parameters
Thanks to Richard Smith <richard@ex-parrot.com> for the patch. Applied with minor changes. Fixes bug #764195. https://bugzilla.gnome.org/show_bug.cgi?id=764195
This commit is contained in:
@@ -1445,21 +1445,35 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
|
|||||||
/*
|
/*
|
||||||
* Name lookup
|
* Name lookup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
name = xsltSplitQName(ctxt->dict, name, &prefix);
|
|
||||||
href = NULL;
|
href = NULL;
|
||||||
if (prefix != NULL) {
|
|
||||||
xmlNsPtr ns;
|
|
||||||
|
|
||||||
ns = xmlSearchNs(style->doc, xmlDocGetRootElement(style->doc),
|
if (name[0] == '{') {
|
||||||
prefix);
|
int len = 0;
|
||||||
if (ns == NULL) {
|
|
||||||
xsltTransformError(ctxt, style, NULL,
|
while ((name[len] != 0) && (name[len] != '}')) len++;
|
||||||
"user param : no namespace bound to prefix %s\n", prefix);
|
if (name[len] == 0) {
|
||||||
href = NULL;
|
xsltTransformError(ctxt, style, NULL,
|
||||||
} else {
|
"user param : malformed parameter name : %s\n", name);
|
||||||
href = ns->href;
|
} else {
|
||||||
}
|
href = xmlDictLookup(ctxt->dict, &name[1], len-1);
|
||||||
|
name = xmlDictLookup(ctxt->dict, &name[len + 1], -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
name = xsltSplitQName(ctxt->dict, name, &prefix);
|
||||||
|
if (prefix != NULL) {
|
||||||
|
xmlNsPtr ns;
|
||||||
|
|
||||||
|
ns = xmlSearchNs(style->doc, xmlDocGetRootElement(style->doc),
|
||||||
|
prefix);
|
||||||
|
if (ns == NULL) {
|
||||||
|
xsltTransformError(ctxt, style, NULL,
|
||||||
|
"user param : no namespace bound to prefix %s\n", prefix);
|
||||||
|
href = NULL;
|
||||||
|
} else {
|
||||||
|
href = ns->href;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
|
@@ -523,6 +523,7 @@ static void usage(const char *name) {
|
|||||||
#endif
|
#endif
|
||||||
printf("\t--encoding: the input document character encoding\n");
|
printf("\t--encoding: the input document character encoding\n");
|
||||||
printf("\t--param name value : pass a (parameter,value) pair\n");
|
printf("\t--param name value : pass a (parameter,value) pair\n");
|
||||||
|
printf("\t name is a QName or a string of the form {URI}NCName.\n");
|
||||||
printf("\t value is an UTF8 XPath expression.\n");
|
printf("\t value is an UTF8 XPath expression.\n");
|
||||||
printf("\t string values must be quoted like \"'string'\"\n or");
|
printf("\t string values must be quoted like \"'string'\"\n or");
|
||||||
printf("\t use stringparam to avoid it\n");
|
printf("\t use stringparam to avoid it\n");
|
||||||
|
Reference in New Issue
Block a user