--- libxml2-2.9.0/tree.c	2012-08-15 00:29:25.000000000 +0200
+++ libxml2-2.9.0-patched-beforeauto/tree.c	2012-09-04 15:45:04.000000000 +0200
@@ -1658,6 +1658,25 @@
 xmlChar *
 xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine)
 {
+    return __xmlNodeListGetString(doc, list, inLine, 0);
+}
+
+/**
+ * __xmlNodeListGetString:
+ * @doc:  the document
+ * @list:  a Node list
+ * @inLine:  should we replace entity contents or show their external form
+ * @htmlAttr: Is this function called to build an html attribute?
+ *
+ * Build the string equivalent to the text contained in the Node list
+ * made of TEXTs and ENTITY_REFs
+ * The public version of this function is xmlNodeListGetString (tree).
+ *
+ * Returns a pointer to the string copy, the caller must free it with xmlFree().
+ */
+xmlChar *
+__xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine,
+                       int htmlAttr) {
     xmlNodePtr node = list;
     xmlChar *ret = NULL;
     xmlEntityPtr ent;
@@ -1673,7 +1692,8 @@
             } else {
                 xmlChar *buffer;
 
-                buffer = xmlEncodeEntitiesReentrant(doc, node->content);
+                buffer = __xmlEncodeEntitiesReentrant(doc, node->content,
+                                                      htmlAttr);
                 if (buffer != NULL) {
                     ret = xmlStrcat(ret, buffer);
                     xmlFree(buffer);
