1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2026-01-07 21:58:22 +03:00

- libxslt/templates.c libxslt/transform.c: fixed bug #54446

about attribute being generated twice. Fixed a number of related
  bugs on attributes handling.
- tests/REC/test-7.1.4.out: this changed an attribute generation
  order
- tests/docs/bug-27-.xml tests/general/bug-27-.*: added test
Daniel
This commit is contained in:
Daniel Veillard
2001-05-11 17:15:46 +00:00
parent 69cf756db5
commit a7c43a4198
9 changed files with 60 additions and 30 deletions

View File

@@ -1,3 +1,12 @@
Fri May 11 19:12:26 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/templates.c libxslt/transform.c: fixed bug #54446
about attribute being generated twice. Fixed a number of related
bugs on attributes handling.
* tests/REC/test-7.1.4.out: this changed an attribute generation
order
* tests/docs/bug-27-.xml tests/general/bug-27-.*: added test
Fri May 11 17:08:14 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/templates.c: fixed bug #54451 on escaped curly brackets

View File

@@ -315,6 +315,7 @@ xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr node,
xmlAttrPtr
xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
xmlAttrPtr cur) {
xmlNsPtr ns;
xmlAttrPtr ret;
if ((ctxt == NULL) || (cur == NULL))
return(NULL);
@@ -335,14 +336,10 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
}
return(NULL);
}
ret = xmlNewDocProp(ctxt->output, cur->name, NULL);
if (ret == NULL) return(NULL);
ret->parent = target;
if (cur->ns != NULL)
ret->ns = xsltGetNamespace(ctxt, cur->parent, cur->ns, target);
ns = xsltGetNamespace(ctxt, cur->parent, cur->ns, target);
else
ret->ns = NULL;
ns = NULL;
if (cur->children != NULL) {
xmlChar *in = xmlNodeListGetString(ctxt->document->doc,
@@ -351,19 +348,16 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
/* TODO: optimize if no template value was detected */
if (in != NULL) {
xmlNodePtr child;
out = xsltAttrTemplateValueProcess(ctxt, in);
child = xmlNewDocText(ctxt->output, out);
xmlAddChild((xmlNodePtr) ret, child);
ret = xmlSetNsProp(target, ns, cur->name, out);
if (out != NULL)
xmlFree(out);
xmlFree(in);
} else
ret->children = NULL;
ret = xmlSetNsProp(target, ns, cur->name, (const xmlChar *)"");
} else
ret->children = NULL;
ret = xmlSetNsProp(target, ns, cur->name, (const xmlChar *)"");
return(ret);
}
@@ -382,7 +376,7 @@ xmlAttrPtr
xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
xmlNodePtr target, xmlAttrPtr cur) {
xmlAttrPtr ret = NULL;
xmlAttrPtr p = NULL,q;
xmlAttrPtr q;
xmlNodePtr oldInsert;
oldInsert = ctxt->insert;
@@ -392,12 +386,8 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
if (q != NULL) {
q->parent = target;
q->doc = ctxt->output;
if (p == NULL) {
ret = p = q;
} else {
p->next = q;
q->prev = p;
p = q;
if (ret == NULL) {
ret = q;
}
}
cur = cur->next;

View File

@@ -544,11 +544,30 @@ xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node) {
current = ctxt->insert->properties;
if (current != NULL) {
while (current->next != NULL)
if ((xmlStrEqual(current->name, ret->name)) &&
(current->ns == ret->ns)) {
xmlNodePtr tmp;
tmp = current->children;
current->children = ret->children;
ret->children = tmp;
xmlFreeProp(ret);
return;
}
while (current->next != NULL) {
current = current->next;
if ((xmlStrEqual(current->name, ret->name)) &&
(current->ns == ret->ns)) {
xmlNodePtr tmp;
tmp = current->children;
current->children = ret->children;
ret->children = tmp;
xmlFreeProp(ret);
return;
}
}
current->next = ret;
ret->prev = current;
}else
} else
ctxt->insert->properties = ret;
}
}
@@ -972,13 +991,6 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
if (cur->properties != NULL) {
attrs = xsltAttrListTemplateProcess(ctxt, copy,
cur->properties);
if (copy->properties != NULL) {
xmlAttrPtr current = copy->properties;
while (current->next != NULL)
current = current->next;
current->next = attrs;
} else
copy->properties = attrs;
}
}
@@ -2497,7 +2509,6 @@ xsltApplyStylesheet(xsltStylesheetPtr style, xmlDocPtr doc,
xsltTransformContextPtr ctxt = NULL;
xmlNodePtr root;
const xmlChar *method;
const xmlChar *encoding;
if ((style == NULL) || (doc == NULL))
return(NULL);

View File

@@ -2,7 +2,7 @@
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" font-size="12pt" font-weight="bold" quadding="start">this is the heading</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" quadding="start" font-size="12pt" font-weight="bold">this is the heading</fo:block>

View File

@@ -30,6 +30,8 @@ EXTRA_DIST = \
bug-23-.xml \
bug-24-.xml \
bug-25-.xml \
bug-26-.xml \
bug-27-.xml \
character.xml \
items.xml

1
tests/docs/bug-27-.xml Normal file
View File

@@ -0,0 +1 @@
<doc/>

View File

@@ -30,6 +30,7 @@ EXTRA_DIST = \
bug-24-.out bug-24-.xsl \
bug-25-.out bug-25-.xsl \
bug-26-.out bug-26-.xsl \
bug-27-.out bug-27-.xsl \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \

View File

@@ -0,0 +1,2 @@
<?xml version="1.0"?>
<p attr="from-xsl-attr"/>

14
tests/general/bug-27-.xsl Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:attribute-set name="my-attr-set">
<xsl:attribute name="attr">from-attr-set</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="/">
<p xsl:use-attribute-sets="my-attr-set" attr="from-p-tag">
<xsl:attribute name="attr">from-xsl-attr</xsl:attribute>
</p>
</xsl:template>
</xsl:stylesheet>