Re: [xslt] libxslt bug
- From: Daniel Veillard <veillard redhat com>
- To: robert <robert xsl 00008 org>
- Cc: xslt gnome org
- Subject: Re: [xslt] libxslt bug
- Date: Wed, 14 Mar 2001 09:42:07 -0500
On Wed, Mar 14, 2001 at 03:06:18PM +0100, robert wrote:
> The output (libxml2-2.3.4/libxslt-0.5.0) becomes:
> <?xml version="1.0"?>
> <foo><option>1</option><blaat>2</blaat><fiets>3</fiets>Test</foo>
>
> Which doesn't seem right :)
Nahhh .. people are never happy :-)
Is that what you expected ?
orchis:~/XSLT/tests/general -> xsltproc bug-3-.xsl ../docs/bug-3-.xml
<?xml version="1.0"?>
<foo option="1" blaat="2" fiets="3">Test</foo>
orchis:~/XSLT/tests/general ->
Patch enclosed ...
Thanks for reporting it !
Daniel
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
*** transform.c 2001/03/08 01:29:13 1.67
--- transform.c 2001/03/14 14:38:35
***************
*** 225,230 ****
--- 225,262 ----
xmlNodePtr insert);
/**
+ * xsltCopyProp:
+ * @ctxt: a XSLT process context
+ * @target: the element where the attribute will be grafted
+ * @attr: the attribute
+ *
+ * Do a copy of an attribute
+ *
+ * Returns: a new xmlAttrPtr, or NULL in case of error.
+ */
+ xmlAttrPtr
+ xsltCopyProp(xsltTransformContextPtr ctxt, xmlNodePtr target,
+ xmlAttrPtr attr) {
+ xmlAttrPtr ret = NULL;
+ xmlNsPtr ns;
+ xmlChar *val;
+
+ if (attr == NULL)
+ return(NULL);
+
+ if (attr->ns != NULL) {
+ ns = xsltGetNamespace(ctxt, attr->parent, attr->ns, target);
+ } else {
+ ns = NULL;
+ }
+ val = xmlNodeListGetString(attr->doc, attr->children, 1);
+ ret = xmlSetNsProp(target, ns, attr->name, val);
+ if (val != NULL)
+ xmlFree(val);
+ return(ret);
+ }
+
+ /**
* xsltCopyPropList:
* @ctxt: a XSLT process context
* @target: the element where the attributes will be grafted
***************
*** 1684,1689 ****
--- 1716,1724 ----
(list->nodeTab[i]->type == XML_HTML_DOCUMENT_NODE)) {
xsltCopyTreeList(ctxt, list->nodeTab[i]->children,
ctxt->insert);
+ } else if (list->nodeTab[i]->type == XML_ATTRIBUTE_NODE) {
+ xsltCopyProp(ctxt, ctxt->insert,
+ (xmlAttrPtr) list->nodeTab[i]);
} else {
xsltCopyTree(ctxt, list->nodeTab[i], ctxt->insert);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]