Index: gsdl/trunk/src/recpt/dynamicclassifieraction.cpp
===================================================================
--- gsdl/trunk/src/recpt/dynamicclassifieraction.cpp	(revision 16114)
+++ gsdl/trunk/src/recpt/dynamicclassifieraction.cpp	(revision 16115)
@@ -181,5 +181,6 @@
   if (!classifier_options["-group_using"].empty())
   {
-    selected_grouping_node_OID = output_grouping_nodes (classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
+    selected_grouping_node_OID = output_hlist_classifier_nodes ("", "", classifier_options["-group_using"], classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
+
     classifier_node_OID = args["dcn"];  // args["dcn"] may have been modified by output_grouping_nodes()
   }
@@ -192,5 +193,5 @@
     text_t classifier_node_metadata_value = selected_grouping_node_OID;
     text_t metadata_value_filter = selected_grouping_node_OID + "*";
-    selected_hlist_node_OID = output_hlist_classifier_nodes (parent_classifier_node_OID, classifier_node_metadata_value, metadata_value_filter, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
+    selected_hlist_node_OID = output_hlist_classifier_nodes (parent_classifier_node_OID, metadata_value_filter, "", classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
     classifier_node_OID = args["dcn"];  // args["dcn"] may have been modified by output_hlist_classifier_nodes()
   }
@@ -291,63 +292,7 @@
 
 
-text_t dynamicclassifieraction::output_grouping_nodes (text_tmap classifier_options, cgiargsclass &args,
-						       recptproto *collectproto, browsermapclass *browsers,
-						       displayclass &disp, outconvertclass &outconvert,
-						       ostream &textout, ostream &logout)
-{
-  // Get all the metadata values for the specified element, and group them according to the "-group_using" value
-  text_t metadata_element_name = classifier_options["metadata_element_name"];
-  text_t metadata_value_grouping_expression = classifier_options["-group_using"];
-  FilterResponse_t grouping_nodes_response;
-  bool request_success = get_metadata_values (metadata_element_name, "", metadata_value_grouping_expression, args["c"], collectproto, grouping_nodes_response, logout);
-
-  // If the request failed then it's probably because the collection isn't using an SQL infodbtype
-  if (request_success == false)
-  {
-    textout << outconvert << disp << "Error: Dynamic classifier functionality is not available. Please check you are using an SQL infodbtype and the collection has been rebuilt.\n";
-    return "";
-  }
-
-  // Check some grouping nodes were returned
-  if (grouping_nodes_response.docInfo.empty())
-  {
-    return "";
-  }
-
-  // If no classifier node has been specified automatically go to the first grouping node
-  if (args["dcn"] == "")
-  {
-    args["dcn"] = grouping_nodes_response.docInfo.front().OID;
-  }
-
-  // Add the necessary metadata to the grouping nodes
-  text_t selected_grouping_node_OID = "";
-  ResultDocInfo_tarray::iterator grouping_node_iterator = grouping_nodes_response.docInfo.begin();
-  while (grouping_node_iterator != grouping_nodes_response.docInfo.end())
-  {
-    // Is this the grouping node that is currently selected?
-    if (starts_with (args["dcn"], (*grouping_node_iterator).OID))
-    {
-      selected_grouping_node_OID = (*grouping_node_iterator).OID;
-    }
-
-    // Add the necessary metadata required to display the grouping nodes correctly
-    (*grouping_node_iterator).metadata["doctype"].values.push_back ("classify");
-    (*grouping_node_iterator).metadata["haschildren"].values.push_back ("1");
-    (*grouping_node_iterator).metadata["numleafdocs"].values.push_back ("?");  // We can't determine this without more database requests
-    (*grouping_node_iterator).metadata["Title"].values.push_back ((*grouping_node_iterator).OID);
-    grouping_node_iterator++;
-  }
-
-  // Display the grouping nodes
-  display_classifier_nodes (grouping_nodes_response, "HList", 0, args, collectproto, browsers, disp, outconvert, textout, logout);
-
-  return selected_grouping_node_OID;
-}
-
-
 text_t dynamicclassifieraction::output_hlist_classifier_nodes (text_t parent_classifier_node_OID,
-							       text_t classifier_node_metadata_value,
 							       text_t metadata_value_filter,
+							       text_t metadata_value_grouping_expression,
 							       text_tmap classifier_options, cgiargsclass &args,
 							       recptproto *collectproto, browsermapclass *browsers,
@@ -358,5 +303,5 @@
   text_t metadata_element_name = classifier_options["metadata_element_name"];
   FilterResponse_t metadata_values_response;
-  bool request_success = get_metadata_values (metadata_element_name, metadata_value_filter, "", args["c"], collectproto, metadata_values_response, logout);
+  bool request_success = get_metadata_values (metadata_element_name, metadata_value_filter, metadata_value_grouping_expression, args["c"], collectproto, metadata_values_response, logout);
 
   // If the request failed then it's probably because the collection isn't using an SQL infodbtype
@@ -379,10 +324,4 @@
   {
     text_t metadata_value = (*metadata_value_iterator).OID;
-
-    // If we're not at the top-level we need to remove the current position from the metadata values
-    if (starts_with(metadata_value, classifier_node_metadata_value + "|"))
-    {
-      metadata_value = substr(metadata_value.begin() + (classifier_node_metadata_value + "|").size(), metadata_value.end());
-    }
 
     // Is this metadata value hierarchical?
Index: gsdl/trunk/src/recpt/dynamicclassifieraction.h
===================================================================
--- gsdl/trunk/src/recpt/dynamicclassifieraction.h	(revision 16114)
+++ gsdl/trunk/src/recpt/dynamicclassifieraction.h	(revision 16115)
@@ -65,12 +65,7 @@
   text_tmap parse_classifier_options (text_t classifier_specification, cgiargsclass &args);
 
-  text_t output_grouping_nodes (text_tmap classifier_options, cgiargsclass &args,
-				recptproto *collectproto, browsermapclass *browsers,
-				displayclass &disp, outconvertclass &outconvert,
-				ostream &textout, ostream &logout);
-
   text_t output_hlist_classifier_nodes (text_t parent_classifier_node_OID,
-					text_t classifier_node_metadata_value,
 					text_t metadata_value_filter,
+					text_t metadata_value_grouping_expression,
 					text_tmap classifier_options, cgiargsclass &args,
 					recptproto *collectproto, browsermapclass *browsers,
