]> git.sesse.net Git - xml-template/commitdiff
In the C++11 version, we would set the wrong key on id+attribute matches. Fixed.
authorsgunderson@bigfoot.com <>
Fri, 23 Sep 2011 22:12:57 +0000 (00:12 +0200)
committersgunderson@bigfoot.com <>
Fri, 23 Sep 2011 22:12:57 +0000 (00:12 +0200)
c++11/xml-template.cpp

index 61d567fdacca1cf7d4a5ae1cd35951858bb316af..503e5e329d4f7269a8115c1c1df20114705b4819 100644 (file)
@@ -201,7 +201,7 @@ void Substitute::process(xmlNode *node, bool clean)
                                        xmlSetProp(child, attr_key, attr_value);
                                } else if ((!id.empty() && begins_with(it.first, "#" + id + "/"))) {
                                        const xmlChar *attr_key = reinterpret_cast<const xmlChar *>(
-                                               it.first.c_str() + tag.size() + 2);
+                                               it.first.c_str() + id.size() + 2);
                                        const xmlChar *attr_value = reinterpret_cast<const xmlChar *>(
                                                it.second->get_contents().c_str());
                                        xmlSetProp(child, attr_key, attr_value);