Index: /gsdl/trunk/src/recpt/dynamicclassifieraction.cpp
===================================================================
--- /gsdl/trunk/src/recpt/dynamicclassifieraction.cpp	(revision 15806)
+++ /gsdl/trunk/src/recpt/dynamicclassifieraction.cpp	(revision 15807)
@@ -35,4 +35,12 @@
   arg_ainfo.shortname = "dcl";
   arg_ainfo.longname = "dynamic classifier ID";
+  arg_ainfo.multiplechar = true;
+  arg_ainfo.defaultstatus = cgiarginfo::weak;
+  arg_ainfo.argdefault = "";
+  arg_ainfo.savedarginfo = cgiarginfo::must;
+  argsinfo.addarginfo (NULL, arg_ainfo);
+
+  arg_ainfo.shortname = "dcn";
+  arg_ainfo.longname = "dynamic classifier node";
   arg_ainfo.multiplechar = true;
   arg_ainfo.defaultstatus = cgiarginfo::weak;
@@ -117,4 +125,5 @@
   }
 
+  text_t metadata_element_name = cinfo->dynamic_classifiers[arg_dcl];
   text_t classifier_type = "VList";
   browserclass *bptr = browsers->getbrowser (classifier_type);
@@ -130,23 +139,51 @@
   bool getParents = false;
   parse_formatstring (formatstring, formatlistptr, metadata, getParents);
+  bool use_table = is_table_content (formatlistptr);
 
-  text_t metadata_element_name = cinfo->dynamic_classifiers[arg_dcl];
-  FilterResponse_t metadata_values_response;
-  get_metadata_values (metadata_element_name, args["c"], collectproto, metadata_values_response, logout);
+  // Check if a dynamic classifier node has been specified
+  text_t arg_dcn = args["dcn"];
+  if (arg_dcn.empty())
+  {
+    // No, so display the top-level classifier page, containing all the metadata values for the specified element
+    FilterResponse_t metadata_values_response;
+    get_metadata_values (metadata_element_name, args["c"], collectproto, metadata_values_response, logout);
 
-  ResultDocInfo_tarray::iterator metadata_value_iterator = metadata_values_response.docInfo.begin();
-  while (metadata_value_iterator != metadata_values_response.docInfo.end())
+    // Add metadata necessary for output_section_group() to display the results as classifier nodes
+    ResultDocInfo_tarray::iterator metadata_value_iterator = metadata_values_response.docInfo.begin();
+    while (metadata_value_iterator != metadata_values_response.docInfo.end())
+    {
+      (*metadata_value_iterator).metadata["doctype"].values.push_back("classify");
+      (*metadata_value_iterator).metadata["haschildren"].values.push_back("1");
+      (*metadata_value_iterator).metadata["numleafdocs"].values.push_back((*metadata_value_iterator).result_num);
+      (*metadata_value_iterator).metadata["Title"].values.push_back((*metadata_value_iterator).OID);
+      metadata_value_iterator++;
+    }
+
+    // Display the classifier nodes
+    bptr->output_section_group (metadata_values_response, args, args["c"], 0, formatlistptr, use_table, metadata, getParents, collectproto, disp, outconvert, textout, logout);
+  }
+  else
   {
-    (*metadata_value_iterator).metadata["doctype"].values.push_back("classify");
-    (*metadata_value_iterator).metadata["haschildren"].values.push_back("1");
-    (*metadata_value_iterator).metadata["numleafdocs"].values.push_back((*metadata_value_iterator).result_num);
-    (*metadata_value_iterator).metadata["Title"].values.push_back((*metadata_value_iterator).OID);
-    metadata_value_iterator++;
+    // Yes, so get all the documents that fall under this node
+    text_t metadata_value = arg_dcn;
+    FilterResponse_t document_OIDs_response;
+    get_documents_with_metadata_value (metadata_element_name, metadata_value, args["c"], collectproto, document_OIDs_response, logout);
+
+    // Make an array of matching document OIDs
+    text_tarray document_OIDs;
+    ResultDocInfo_tarray::iterator document_OID_iterator = document_OIDs_response.docInfo.begin();
+    while (document_OID_iterator != document_OIDs_response.docInfo.end())
+    {
+      document_OIDs.push_back ((*document_OID_iterator).OID);
+      document_OID_iterator++;
+    }
+
+    // Request the necessary metadata for these documents
+    FilterResponse_t document_info_response;
+    get_info (document_OIDs, args["c"], args["l"], metadata, getParents, collectproto, document_info_response, logout);
+
+    // Display the document nodes
+    bptr->output_section_group (document_info_response, args, args["c"], 0, formatlistptr, use_table, metadata, getParents, collectproto, disp, outconvert, textout, logout);
   }
-
-  // Display the nodes
-  bool use_table = is_table_content (formatlistptr);
-  bptr->output_section_group (metadata_values_response, args, args["c"], 0, formatlistptr, use_table, 
-			      metadata, getParents, collectproto, disp, outconvert, textout, logout);
 
   textout << outconvert << disp << "_document:footer_\n";
