Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/abstractlistaction.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/abstractlistaction.cpp	(revision 27533)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/abstractlistaction.cpp	(revision 27534)
@@ -84,6 +84,6 @@
   }
 
-  // Case for no "set" argument present -- output all records in all collections
-  // or we are a super collection
+  // Case for no "set" argument present - output all records in all collections & super colls
+  // Case for super collection set - output all records in all collections in this super coll
   else
   {
@@ -94,5 +94,7 @@
       collections = this->configuration->getSuperCollectionCollections(set_name);
     } else {
-      collections = this->configuration->getCollectionsList();
+      
+      collections = this->configuration->getAllCollectionsList();//this->configuration->getCollectionsList();
+	
     }
     if (collections.size() == 0)
@@ -121,5 +123,5 @@
     {
       // If output_content_for_set() returns false a resumption token has been output, so it's time to stop
-      if (output_content_for_set(output, protocol, params, *collection_iterator, "", "") == false)
+      if (output_content_for_set(output, protocol, params, *collection_iterator, "", set_name) == false)
       {
 	return true;
Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/listidsaction.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/listidsaction.cpp	(revision 27533)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/listidsaction.cpp	(revision 27534)
@@ -210,21 +210,8 @@
 
     // Check the collection is one that is in the list in the oai.cfg file
-    text_tarray &collections = this->configuration->getCollectionsList();
-    bool collection_found = false;
-    for (int c = 0; c < collections.size(); c++)
-    {
-      if (collections[c] == collection)
-      {
-	collection_found = true;
-	break;
-      }
-    }
-
-    // The collection was not found
-    if (!collection_found)
-    {
-      this->errorType = "badArgument";
-      return false;
-    }
+    if (!this->configuration->isValidCollection(collection)) {
+      this->errorType = "badArgument";
+      return false;
+    }      
 
     // Check the child set if it was given
Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/listrecsaction.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/listrecsaction.cpp	(revision 27533)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/listrecsaction.cpp	(revision 27534)
@@ -165,4 +165,20 @@
     text_t set = params["set"];
 
+    // Is the set a super collection??
+    text_tarray &super_collections = this->configuration->getSuperCollectionsList();
+    bool super_collection_found = false;
+    for (int c = 0; c < super_collections.size(); c++)
+    {
+      if (super_collections[c] == set)
+      {
+	super_collection_found = true;
+	break;
+      }
+    }
+    if (super_collection_found) {
+      this->errorType = "";
+      return true;
+    }
+
     // Extract the collection name from the set specification
     text_t collection = "";
@@ -180,21 +196,8 @@
 	
     // Check the collection is one that is in the list in the oai.cfg file
-    text_tarray &collections = this->configuration->getCollectionsList();
-    bool collection_found = false;
-    for (int c = 0; c < collections.size(); c++)
-    {
-      if (collections[c] == collection)
-      {
-	collection_found = true;
-	break;
-      }
-    }
-
-    // The collection was not found
-    if (!collection_found)
-    {
-      this->errorType = "badArgument";
-      return false;
-    }
+    if (!this->configuration->isValidCollection(collection)) {
+      this->errorType = "badArgument";
+      return false;
+    }      
 
     // Check the child set if it was given
Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/listsetsaction.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/listsetsaction.cpp	(revision 27533)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/listsetsaction.cpp	(revision 27534)
@@ -124,26 +124,32 @@
   }
 
+  // if no resumption token, output the super colls. Otherwise, start from 
+  // the collection list correct position.
+  // Assume for now that super coll list is always first in the list of sets,
+  // and we never issue a resumption token part way through the list of super colls
+  // TODO handle resumption tokens properly.
+  text_t set_name ="";
+  if (position == "") {
+    text_tarray& supercolls = this->configuration->getSuperCollectionsList();
+    text_tarray::iterator supercoll_iterator = supercolls.begin();
+    while (supercoll_iterator != supercolls.end()) {
+      set_name = (*supercoll_iterator);
+      output_content_for_supercol(output, set_name);
+      supercoll_iterator++;
+    }
+  }
+
+
   // Get a list of the collections available
   text_tarray& collections = this->configuration->getCollectionsList();
   if (collections.size() == 0)
   {
-    return false;
-  }
-
-  // if no resumption token, output the super colls. Otherwise, start from 
-  // the collection list correct position.
-  // Assume for now that super coll list is always in the first list
-  text_t set_name ="";
-  if (position == "") {
-    text_tarray& supercolls = this->configuration->getSuperCollectionsList();
-    if (collections.size() != 0) {
-      text_tarray::iterator supercoll_iterator = supercolls.begin();
-      while (supercoll_iterator != supercolls.end()) {
-	set_name = (*supercoll_iterator);
-	output_content_for_supercol(output, set_name);
-	supercoll_iterator++;
-      }
-    }
-  }
+    if (this->setsOutput ==0) {
+      // we had no super colls either
+      return false;
+    }
+    return true;
+  }
+
   // Get the current collection from the position value
   text_t collection_name = "";
Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiaction.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiaction.cpp	(revision 27533)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiaction.cpp	(revision 27534)
@@ -414,6 +414,9 @@
     if(oaiVersion >= 200){
 
-      // A doc is always a member of its collection set
-      output << "      <setSpec>" << collection_id << "</setSpec>" << endl;
+      // A doc is only a member of its collection set if hte collection is valid
+      // Can have super collecitons containging collecitons that are not individually valid
+      if (this->configuration->isValidCollection(collection_id)) {
+	output << "      <setSpec>" << collection_id << "</setSpec>" << endl;
+      }
       // are we part of a super collection?
       text_tarray super_colls = this->configuration->getSuperCollectionsForThisCollection(collection_id);
Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.cpp	(revision 27533)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.cpp	(revision 27534)
@@ -110,4 +110,13 @@
   }
   return 200; 
+}
+
+bool oaiconfig::isValidCollection(const text_t &collection)
+{
+  for (int c = 0; c < this->collectList.size(); c++)
+    if (this->collectList[c] == collection) {
+      return true;
+    }
+  return false;
 }
 
@@ -208,9 +217,10 @@
     for (int c = 0; c < cfgline.size(); ++c) {
       this->collectList.push_back(cfgline[c]);
+      addToAllCollectionsList(cfgline[c]);
     }
   }
   else if (key == "oaisupercollection" && cfgline.size() > 1) {
 
-    // Configure a hierarchical super set
+    // Configure a super collection set
     // The line should read 
     //
@@ -240,4 +250,5 @@
       }
       this->collectMap[sub_coll]->superCollectList.push_back(super_set);
+      addToAllCollectionsList(sub_coll);
     }
   }
@@ -358,5 +369,13 @@
   }
 }
-
+  
+void oaiconfig::addToAllCollectionsList(const text_t coll_name) {
+
+  for (int c=0; c<this->allCollectList.size(); c++) {
+    if (allCollectList[c] == coll_name) return;
+  }
+  this->allCollectList.push_back(coll_name);
+  
+}
 
 text_t oaiconfig::generateBaseServerURL() {
@@ -481,5 +500,7 @@
 }
 
-text_tarray oaiconfig::getSuperCollectionsForThisCollection(const text_t &collection) {
+
+text_tarray oaiconfig::getSuperCollectionsForThisCollection(const text_t &collection)
+{
 
   text_tarray super_colls;
Index: /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.h
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.h	(revision 27533)
+++ /main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.h	(revision 27534)
@@ -63,8 +63,14 @@
   virtual void  configure(const text_t &key, const text_tarray &cfgline);
   text_tarray & getCollectionsList() { return this->collectList; }
+  // get a list of all collections - those part of a super coll and those individual ones
+  text_tarray & getAllCollectionsList() {return this->allCollectList; }
   text_tarray & getSuperCollectionsList() { return this->superCollectList; }
+  // get the list of collections for this super coll
   text_tarray & getSuperCollectionCollections(const text_t super_coll) {
     return this->superCollectMap[super_coll]->collectionList;
   }
+  // is this collection valid
+  bool isValidCollection(const text_t &collection);
+  // what super collections is this collection part of?
   text_tarray getSuperCollectionsForThisCollection(const text_t &collection);
   text_tset & getMetadataSet() { return this->metadataSet; }
@@ -86,4 +92,5 @@
  private:
   bool configureCollection(const text_t &gsdlhome, const text_t &collection);
+  void addToAllCollectionsList(const text_t coll_name);
   text_t generateBaseServerURL();
   text_t    repositoryName; // human readable name
@@ -106,4 +113,5 @@
   text_tarray superCollectList; //a list of super collections. may be empty
   oaisupercollectmap superCollectMap; // The configuration of the super collections
+  text_tarray allCollectList; //a list of all collections, includes those in collectList and those that are part of a super collection and not in collectList
 };
 #endif
