fixing rendering of attributes when parent node is not in the node set
diff --git a/ChangeLog b/ChangeLog
index a09b67c..3c01138 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-07 Aleksey Sanin <aleksey@aleksey.com>
+
+ * c14n.c: fix rendering of attributes when parent node
+ is not in the node set
+
2005-06-06 Aleksey Sanin <aleksey@aleksey.com>
* c14n.c: fixed xml attributes processing bug in exc c14n
diff --git a/c14n.c b/c14n.c
index 5f18581..32c7004 100644
--- a/c14n.c
+++ b/c14n.c
@@ -946,6 +946,7 @@
* xmlC14NProcessAttrsAxis:
* @ctx: the C14N context
* @cur: the current node
+ * @parent_visible: the visibility of parent node
*
* Prints out canonical attribute axis of the current node to the
* buffer from C14N context as follows
@@ -974,7 +975,7 @@
* Returns 0 on success or -1 on fail.
*/
static int
-xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur)
+xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
{
xmlAttrPtr attr;
xmlListPtr list;
@@ -1009,7 +1010,7 @@
* include attributes in "xml" namespace defined in ancestors
* (only for non-exclusive XML Canonicalization)
*/
- if ((!ctx->exclusive) && (cur->parent != NULL)
+ if (parent_visible && (!ctx->exclusive) && (cur->parent != NULL)
&& (!xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent))) {
/*
* If XPath node-set is not specified then the parent is always
@@ -1171,12 +1172,10 @@
xmlC14NVisibleNsStackShift(ctx->ns_rendered);
}
- if(visible) {
- ret = xmlC14NProcessAttrsAxis(ctx, cur);
- if (ret < 0) {
- xmlC14NErrInternal("processing attributes axis");
- return (-1);
- }
+ ret = xmlC14NProcessAttrsAxis(ctx, cur, visible);
+ if (ret < 0) {
+ xmlC14NErrInternal("processing attributes axis");
+ return (-1);
}
if (visible) {