+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
xmlAttrPtr
xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
xmlAttrPtr cur) {
+ xmlNsPtr ns;
xmlAttrPtr ret;
if ((ctxt == NULL) || (cur == NULL))
return(NULL);
}
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,
/* 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);
}
xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
xmlNodePtr target, xmlAttrPtr cur) {
xmlAttrPtr ret = NULL;
- xmlAttrPtr p = NULL,q;
+ xmlAttrPtr q;
xmlNodePtr oldInsert;
oldInsert = ctxt->insert;
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;
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;
}
}
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;
}
}
xsltTransformContextPtr ctxt = NULL;
xmlNodePtr root;
const xmlChar *method;
- const xmlChar *encoding;
if ((style == NULL) || (doc == NULL))
return(NULL);
-<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>
bug-23-.xml \
bug-24-.xml \
bug-25-.xml \
+ bug-26-.xml \
+ bug-27-.xml \
character.xml \
items.xml
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 \
--- /dev/null
+<?xml version="1.0"?>
+<p attr="from-xsl-attr"/>
--- /dev/null
+<?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>