roxen.lists.roxen.general

Subject Author Date
Re: Problem with value-of in contents tag Martin Stjernholm <mast[at]roxen[dot]com> 09-10-2008
"Petter Larsson" <<petterl[at]lysator.liu.se>> skrev:

> I dont know why i expected the index to be "value", after a patch I
> get the correct values and dont need the double emits either.

You could have used subindexing to avoid the inner emit before too:

  <emit source="values" variable="_.tag2">
    &_.value.value;
  </emit>

Thanks for the bug report. I did a bit different fix to handle @*
correctly:

Index: modules/tags/rxmltags.pike
===================================================================
RCS file: /cvs/Roxen/5.0/server/modules/tags/rxmltags.pike,v
retrieving revision 1.558
retrieving revision 1.559
diff -u -r1.558 -r1.559
--- modules/tags/rxmltags.pike	16 Sep 2008 10:37:30 -0000	1.558
+++ modules/tags/rxmltags.pike	9 Oct 2008 11:44:52 -0000	1.559
@@ -4042,13 +4042,15 @@
 
 	  else {
 	    if (result_set) {
-	      if (arrayp (res))
-		value = map (res, lambda (mapping|SloppyDOM.Node elem) {
-				    if (objectp (elem))
-				      return elem->get_text_content();
-				    else
-				      return values (res)[0];
-				  });
+	      if (arrayp (res)) {
+		value = ({});
+		foreach (res, mapping|SloppyDOM.Node elem) {
+		  if (objectp (elem))
+		    value += ();
+		  else
+		    value += values (elem);
+		}
+	      }
 	      else if (objectp (res))
 		value = ();
 	      else if (mappingp (res))

A problem is that the fix has some compatibility issues since the
indexing might be different. I decided to ignore that in this case.