From: sgunderson@bigfoot.com <> Date: Fri, 23 Sep 2011 22:12:57 +0000 (+0200) Subject: In the C++11 version, we would set the wrong key on id+attribute matches. Fixed. X-Git-Url: https://git.sesse.net/?p=xml-template;a=commitdiff_plain;h=67503cff975c04009dd3658c50cd9a4bf3a39ec5 In the C++11 version, we would set the wrong key on id+attribute matches. Fixed. --- diff --git a/c++11/xml-template.cpp b/c++11/xml-template.cpp index 61d567f..503e5e3 100644 --- a/c++11/xml-template.cpp +++ b/c++11/xml-template.cpp @@ -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( - it.first.c_str() + tag.size() + 2); + it.first.c_str() + id.size() + 2); const xmlChar *attr_value = reinterpret_cast( it.second->get_contents().c_str()); xmlSetProp(child, attr_key, attr_value);