mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:02:56 +00:00
[LIBXSLT] Update to version 1.1.34. CORE-16952
This commit is contained in:
parent
f22fa382fe
commit
b01a480163
22 changed files with 657 additions and 374 deletions
134
dll/3rdparty/libxslt/templates.c
vendored
134
dll/3rdparty/libxslt/templates.c
vendored
|
@ -314,7 +314,7 @@ xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
|
|||
nsNr = i;
|
||||
}
|
||||
}
|
||||
comp = xmlXPathCompile(expr);
|
||||
comp = xmlXPathCtxtCompile(ctxt->xpathCtxt, expr);
|
||||
val = xsltEvalXPathStringNs(ctxt, comp, nsNr, nsList);
|
||||
xmlXPathFreeCompExpr(comp);
|
||||
xmlFree(expr);
|
||||
|
@ -627,11 +627,12 @@ xmlAttrPtr
|
|||
xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr target, xmlAttrPtr attrs)
|
||||
{
|
||||
xmlAttrPtr attr, copy, last;
|
||||
xmlAttrPtr attr, copy, last = NULL;
|
||||
xmlNodePtr oldInsert, text;
|
||||
xmlNsPtr origNs = NULL, copyNs = NULL;
|
||||
const xmlChar *value;
|
||||
xmlChar *valueAVT;
|
||||
int hasAttr = 0;
|
||||
|
||||
if ((ctxt == NULL) || (target == NULL) || (attrs == NULL) ||
|
||||
(target->type != XML_ELEMENT_NODE))
|
||||
|
@ -640,16 +641,35 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
|||
oldInsert = ctxt->insert;
|
||||
ctxt->insert = target;
|
||||
|
||||
/*
|
||||
* Apply attribute-sets.
|
||||
*/
|
||||
attr = attrs;
|
||||
do {
|
||||
#ifdef XSLT_REFACTORED
|
||||
if ((attr->psvi == xsltXSLTAttrMarker) &&
|
||||
xmlStrEqual(attr->name, (const xmlChar *)"use-attribute-sets"))
|
||||
{
|
||||
xsltApplyAttributeSet(ctxt, ctxt->node, (xmlNodePtr) attr, NULL);
|
||||
}
|
||||
#else
|
||||
if ((attr->ns != NULL) &&
|
||||
xmlStrEqual(attr->name, (const xmlChar *)"use-attribute-sets") &&
|
||||
xmlStrEqual(attr->ns->href, XSLT_NAMESPACE))
|
||||
{
|
||||
xsltApplyAttributeSet(ctxt, ctxt->node, (xmlNodePtr) attr, NULL);
|
||||
}
|
||||
#endif
|
||||
attr = attr->next;
|
||||
} while (attr != NULL);
|
||||
|
||||
if (target->properties != NULL) {
|
||||
hasAttr = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Instantiate LRE-attributes.
|
||||
*/
|
||||
if (target->properties) {
|
||||
last = target->properties;
|
||||
while (last->next != NULL)
|
||||
last = last->next;
|
||||
} else {
|
||||
last = NULL;
|
||||
}
|
||||
attr = attrs;
|
||||
do {
|
||||
/*
|
||||
|
@ -685,35 +705,7 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
|||
value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0);
|
||||
|
||||
/*
|
||||
* Create a new attribute.
|
||||
*/
|
||||
copy = xmlNewDocProp(target->doc, attr->name, NULL);
|
||||
if (copy == NULL) {
|
||||
if (attr->ns) {
|
||||
xsltTransformError(ctxt, NULL, attr->parent,
|
||||
"Internal error: Failed to create attribute '{%s}%s'.\n",
|
||||
attr->ns->href, attr->name);
|
||||
} else {
|
||||
xsltTransformError(ctxt, NULL, attr->parent,
|
||||
"Internal error: Failed to create attribute '%s'.\n",
|
||||
attr->name);
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
/*
|
||||
* Attach it to the target element.
|
||||
*/
|
||||
copy->parent = target;
|
||||
if (last == NULL) {
|
||||
target->properties = copy;
|
||||
last = copy;
|
||||
} else {
|
||||
last->next = copy;
|
||||
copy->prev = last;
|
||||
last = copy;
|
||||
}
|
||||
/*
|
||||
* Set the namespace. Avoid lookups of same namespaces.
|
||||
* Get the namespace. Avoid lookups of same namespaces.
|
||||
*/
|
||||
if (attr->ns != origNs) {
|
||||
origNs = attr->ns;
|
||||
|
@ -730,7 +722,47 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
|||
} else
|
||||
copyNs = NULL;
|
||||
}
|
||||
copy->ns = copyNs;
|
||||
/*
|
||||
* Create a new attribute.
|
||||
*/
|
||||
if (hasAttr) {
|
||||
copy = xmlSetNsProp(target, copyNs, attr->name, NULL);
|
||||
} else {
|
||||
/*
|
||||
* Avoid checking for duplicate attributes if there aren't
|
||||
* any attribute sets.
|
||||
*/
|
||||
copy = xmlNewDocProp(target->doc, attr->name, NULL);
|
||||
|
||||
if (copy != NULL) {
|
||||
copy->ns = copyNs;
|
||||
|
||||
/*
|
||||
* Attach it to the target element.
|
||||
*/
|
||||
copy->parent = target;
|
||||
if (last == NULL) {
|
||||
target->properties = copy;
|
||||
last = copy;
|
||||
} else {
|
||||
last->next = copy;
|
||||
copy->prev = last;
|
||||
last = copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy == NULL) {
|
||||
if (attr->ns) {
|
||||
xsltTransformError(ctxt, NULL, attr->parent,
|
||||
"Internal error: Failed to create attribute '{%s}%s'.\n",
|
||||
attr->ns->href, attr->name);
|
||||
} else {
|
||||
xsltTransformError(ctxt, NULL, attr->parent,
|
||||
"Internal error: Failed to create attribute '%s'.\n",
|
||||
attr->name);
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the value.
|
||||
|
@ -785,30 +817,6 @@ next_attribute:
|
|||
attr = attr->next;
|
||||
} while (attr != NULL);
|
||||
|
||||
/*
|
||||
* Apply attribute-sets.
|
||||
* The creation of such attributes will not overwrite any existing
|
||||
* attribute.
|
||||
*/
|
||||
attr = attrs;
|
||||
do {
|
||||
#ifdef XSLT_REFACTORED
|
||||
if ((attr->psvi == xsltXSLTAttrMarker) &&
|
||||
xmlStrEqual(attr->name, (const xmlChar *)"use-attribute-sets"))
|
||||
{
|
||||
xsltApplyAttributeSet(ctxt, ctxt->node, (xmlNodePtr) attr, NULL);
|
||||
}
|
||||
#else
|
||||
if ((attr->ns != NULL) &&
|
||||
xmlStrEqual(attr->name, (const xmlChar *)"use-attribute-sets") &&
|
||||
xmlStrEqual(attr->ns->href, XSLT_NAMESPACE))
|
||||
{
|
||||
xsltApplyAttributeSet(ctxt, ctxt->node, (xmlNodePtr) attr, NULL);
|
||||
}
|
||||
#endif
|
||||
attr = attr->next;
|
||||
} while (attr != NULL);
|
||||
|
||||
ctxt->insert = oldInsert;
|
||||
return(target->properties);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue