Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java	(revision 3567)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java	(revision 3568)
@@ -8,13 +8,14 @@
 import org.w3c.dom.Document; 
 
+/** base class for Actions */
 abstract public class Action {
 
+    /** the interface setup variables */
     protected ConfigVars config_=null;
- 
     /** container Document to create XML Nodes */
     protected Document doc_=null; 
     /** a converter class to parse XML and create Docs */
     protected XMLConverter converter_=null;
-    /** cgi args conveter */
+    /** cgi args converter */
     protected CGIArgConverter cgi_=null;
     /** a transformer class to transform xml using xslt */
@@ -55,8 +56,9 @@
 	Element message = converter_.getDOM(xml_in).getDocumentElement();
 	
-	return process(message);
+	Element result = process(message);
+	return converter_.getString(result);
     }
 	
-    abstract public String process(Element xml_in);
+    abstract public Element process(Element xml_in);
 	
 
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/AppletAction.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/AppletAction.java	(revision 3567)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/AppletAction.java	(revision 3568)
@@ -12,9 +12,10 @@
 import java.io.File;
 
+/** action class for handling applets */
 public class AppletAction extends Action {
     
 
-    public String process (Element message) {
-
+    public Element process (Element message) {
+	
 
 	// find the stylesheet
@@ -22,19 +23,20 @@
 
 	if (stylesheet==null) {
-	    return GSHTML.errorPage("applet stylesheet not found!");
+	    System.err.println("AppletAction Error: applet stylesheet not found!");
+	    return null;
 	}
-
-	Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0);
-
-	// subaction is display/request
-	String request_type = request.getAttribute(GSXML.SUBACTION_ATT); // should be 'd' or 'r'
+	
+	Element request = (Element)GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM);
+	
+	// subaction is display (d) or request (r)
+	String request_type = request.getAttribute(GSXML.SUBACTION_ATT); 
 	if (!request_type.equals("d")&&!request_type.equals("r")) {
-	    return GSHTML.errorPage("the sa arg to a=a should be d or r!!");
+	    System.err.println("AppletAction Error: the sa arg should be either d or r, instead it was "+request_type+"!");
+	    return null;
 	}
 	
 	// get the collection and service param
-	Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	cgi_.toLong(cgi_paramList);
-	HashMap params = GSXML.extractParams(cgi_paramList);
+	Element cgi_param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
+	HashMap params = GSXML.extractParams(cgi_param_list);
 
 	String collection = (String)params.get("collection");
@@ -49,7 +51,4 @@
 	}
 
-	System.out.println("to="+to);
-
-
 	if (request_type.equals("d")) {
 	    // we are just displaying the applet - get the description from
@@ -62,16 +61,14 @@
 	    mr_message.appendChild(mr_request);
 	    mr_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);
+	    mr_request.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
 	    mr_request.setAttribute(GSXML.TO_ATT, to);
-	    //mr_request.setAttribute(GSXML."info", "appletInfo");
 	    
 	    Element mr_response = (Element)mr_.process(mr_message);
 	    
-	    System.out.println("applet mr response =");
-	    System.out.println(converter_.getString(mr_response));
 	    // create the return page tree
 	    Element page = doc_.createElement(GSXML.PAGE_ELEM);
-	    page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT));
+	    page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
 	    // add the lang stuff from message
-	    page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true));
+	    page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.DISPLAY_ELEM), true));
 	    // add the config stuff from message
 	    page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
@@ -92,5 +89,5 @@
 	    Document style_doc = converter_.getDOM(new File(stylesheet));
 	    GSXSLT.absoluteIncludePaths(style_doc, config_);
-	    return transformer_.transform(style_doc, page);    
+	    return (Element)transformer_.transform(style_doc, page);    
 
 	}
@@ -103,25 +100,19 @@
 	    mr_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY);
 	    mr_request.setAttribute(GSXML.TO_ATT, to);
-	    
+	    mr_request.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
+
 	    // just append the params for now
-	    mr_request.appendChild(doc_.importNode(cgi_paramList, true));
+	    mr_request.appendChild(doc_.importNode(cgi_param_list, true));
 	    
 	    Element mr_response = (Element)mr_.process(mr_message);
-	    System.out.println("applet query response:");
-	    // dont need to create a page, just extract the info out.
-	    System.out.println(converter_.getString(mr_response));
 	    // add in the applet data
 	    String path = GSXML.RESPONSE_ELEM;
 	    path = GSPath.appendLink(path, GSXML.APPLET_DATA_ELEM);
 	    Element applet_info = (Element)GSXML.getNodeByPath(mr_response, path).getFirstChild();
-	    System.out.println("applet action: applet data =");
-	    System.out.println(converter_.getString(applet_info));
-	    return converter_.getString(applet_info);
+	    return applet_info;
 
 	}
-	else {
-	    // should never get here
-	    return GSHTML.errorPage("applet action, wrong subaction type");
-	}
+	// should never get here
+	return null;
     }
 
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java	(revision 3567)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java	(revision 3568)
@@ -10,18 +10,21 @@
 import java.util.HashMap;
 import java.io.File;
+
+/** action for classifier browsing */
 public class BrowseAction extends Action {
     
+    public Element process (Element message) {
 
-    public String process (Element message) {
-
+	// get the request - assume only one
+	Element request = (Element)GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM);
+	
 	// create the return page tree
 	Element page = doc_.createElement(GSXML.PAGE_ELEM);
-	page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT));
+	page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
 	// add the lang stuff from message
-	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true));
+	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.DISPLAY_ELEM), true));
 	// add the system stuff from message
 	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
 
-	Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0);
 	
 	// the browse type is the subaction
@@ -37,10 +40,11 @@
     
 
-    protected String classifierBrowse(Element page, Element request) {
+    protected Element classifierBrowse(Element page, Element request) {
 
 	// check that the stylesheet is present - cant output a page without one. we may adapt this to use unknownquery stylesheet? - or ask for one from the MR
 	String stylesheet = GSFile.stylesheetFile(config_, "classifier.xsl");
 	if (stylesheet==null) {
-	    return GSHTML.errorPage("classifier stylesheet not found!");
+	    System.err.println("BrowseAction Error: classifier stylesheet not found!");
+	    return null;
 	}
 	Document style_doc = converter_.getDOM(new File(stylesheet));
@@ -54,12 +58,11 @@
 	String collection = (String)params.get("collection");
 	if (collection == null || collection.equals("")) {
-	    return GSHTML.errorPage("classifierbrowse, need to specify a collection!");
+	    System.err.println("BrowseAction Error:classifierbrowse, need to specify a collection!");
+	    return null;
+	   
 	}
 
-	// the first part of the data for the page is the cgi-params
-	Element cgi_request = (Element)doc_.importNode(request, true);
-	page.appendChild(cgi_request);
 
-	// get the service info from the MR - this will probably need to be cached somehow later on. and add as a description node to the cgi-request - this doesn't work. change to add the specified value as a current attribute to the param - need to do somthing different for query
+	// get the service info from the MR - this will probably need to be cached somehow later on. 
 
 	Element mr_info_message = doc_.createElement(GSXML.MESSAGE_ELEM);
@@ -67,4 +70,5 @@
 	mr_info_message.appendChild(mr_info_request);
 	mr_info_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);
+	mr_info_request.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
 
 	String to = collection;
@@ -73,69 +77,67 @@
 
 	Element mr_info_response = (Element) mr_.process(mr_info_message);
-	Element description = doc_.createElement(GSXML.DESCRIPTION_ELEM);
 
 	String path = GSXML.RESPONSE_ELEM;
 	path = GSPath.appendLink(path, GSXML.SERVICE_ELEM);
-	path = GSPath.appendLink(path, GSXML.CLASSIFIER_ELEM+GSXML.LIST_MODIFIER);
-	Node cl = GSXML.getNodeByPath(mr_info_response, path);
 
-	Element imported_classList = (Element)doc_.importNode(cl, true);
+	Element description = (Element)doc_.importNode(GSXML.getNodeByPath(mr_info_response, path), true);
+	
+	// the first part of the data for the page is the cgi-params
+	Element cgi_request = (Element)doc_.importNode(request, true);
+	page.appendChild(cgi_request);
 
-	description.appendChild(imported_classList);
-	cgi_request.appendChild(description);
-
-
+	page.appendChild(description);
+	
 	// if there is a cl field in the cgi params, get the classifier info
 	String node = (String)params.get("classifier");
+	
+	if (node!=null && !node.equals("")) {
 
-	if (node==null|| node.equals("")) {
-	    System.out.println("no cl node selected");
-	    // if there is no cl set, just output the list
-	    GSXSLT.absoluteIncludePaths(style_doc, config_);
-	    return transformer_.transform(style_doc, page);       
+	    // get the info for the selected node
+	    Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM);
+	    Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM);
+	    mr_query_message.appendChild(mr_query_request);
+	    
+	    mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY);
+	    mr_query_request.setAttribute(GSXML.TO_ATT, to);
+	    mr_query_request.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
+	    
+	    
+	    // paramList - empty for now
+	    Element paramList = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
+	    mr_query_request.appendChild(paramList);
+	    
+	    
+	    // content - contains the classifier node, may be more than one
+	    // call this resource list for now
+	    Element query_content = doc_.createElement(GSXML.CONTENT_ELEM);
+	    mr_query_request.appendChild(query_content);
+	    
+	    Element resource_list = doc_.createElement(GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER);
+	    Element resource = doc_.createElement(GSXML.RESOURCE_ELEM);
+	    resource.setAttribute(GSXML.NAME_ATT, node);
+	    resource_list.appendChild(resource);
+	    query_content.appendChild(resource_list);
+	    
+	    Element mr_query_response = (Element)mr_.process(mr_query_message);
+	    
+	    Element response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
+	    Node new_style = GSXML.getChildByTagName(response, "stylesheet");
+	    if (new_style !=null) {
+		GSXSLT.mergeStylesheets(style_doc, (Element)new_style);
+		response.removeChild(new_style);
+	    }
+	    // add the response to the page data
+	    page.appendChild(doc_.importNode(response, true));
+
 	}
 	
-	// get the info for the selected node
-	Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM);
-	Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM);
-	mr_query_message.appendChild(mr_query_request);
-
-	mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY);
-	mr_query_request.setAttribute(GSXML.TO_ATT, to);
-
-	// paramList - empty for now
-	Element paramList = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	mr_query_request.appendChild(paramList);
-
-
-	// content - contains the classifier node, may be more than one
-	// call this resource list for now
-	Element query_content = doc_.createElement(GSXML.CONTENT_ELEM);
-	mr_query_request.appendChild(query_content);
-	
-	Element resource_list = doc_.createElement(GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER);
-	Element resource = doc_.createElement(GSXML.RESOURCE_ELEM);
-	resource.setAttribute(GSXML.NAME_ATT, node);
-	resource_list.appendChild(resource);
-	query_content.appendChild(resource_list);
-
-	Element mr_query_response = (Element)mr_.process(mr_query_message);
-
-	Element response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
-	Node new_style = GSXML.getChildByTagName(response, "stylesheet");
-	if (new_style !=null) {
-	    GSXSLT.mergeStylesheets(style_doc, (Element)new_style);
-	    response.removeChild(new_style);
-	}
-	// add the response to the page data
-	page.appendChild(doc_.importNode(response, true));
-
 	GSXSLT.absoluteIncludePaths(style_doc, config_);
-	return transformer_.transform(style_doc, page);
+	return (Element)transformer_.transform(style_doc, page);
     }
 
-    protected String unknownBrowse(Element page, Element request, String browse_type) {
-
-	return GSHTML.errorPage("unknown browse subtype: "+browse_type);
+    protected Element unknownBrowse(Element page, Element request, String browse_type) {
+	System.err.println("BrowseAction Error: unknown browse subtype: "+browse_type);
+	return null;
     }
 }
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BuildAction.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BuildAction.java	(revision 3567)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BuildAction.java	(revision 3568)
@@ -17,132 +17,107 @@
     
 
-    public String process (Element message) {
+    public Element process (Element message) {
 
-	//find the stylesheet
+	//find the stylesheet - cant go any further if not found
 	String stylesheet = GSFile.stylesheetFile(config_, "build.xsl");
 
 	if (stylesheet==null) {
-	    return GSHTML.errorPage("build stylesheet not found!");
+	    System.err.println("BuildAction Error: build stylesheet not found!");
+	    return null;
 	}
+
+	Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0);
+	String service_name = request.getAttribute(GSXML.SUBACTION_ATT); 
+	// get the param list
+	Element cgi_param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
+	HashMap params = GSXML.extractParams(cgi_param_list);
 
 	// create the return page tree
 	Element page = doc_.createElement(GSXML.PAGE_ELEM);
-	page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT));
+	page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
 	// add the lang stuff from message
-	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true));
+	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.DISPLAY_ELEM), true));
 	// add the system stuff from message
 	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
+	
 
-	Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0);
-	String service_name = request.getAttribute(GSXML.SUBACTION_ATT); 
+	//  we need to do the request before getting the description- 
+	// it may have changedthe action may change the descripiton, eg 
+	// deleting a collection changes the collection list
+	String collection = (String)params.get("collection");
+	String to = "build"; // knwo this cos its build action - loaded by a cluster called build
+	to = GSPath.appendLink(to, service_name);
 	
-	// get the param list
-	Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	cgi_.toLong(cgi_paramList);
-	HashMap params = GSXML.extractParams(cgi_paramList);
+	if (collection != null && !collection.equals("")) {
+	    
+	    // a collection has been specified - do the request
+	    Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM);
+	    Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM);
+	    mr_query_message.appendChild(mr_query_request);
+	    
+	    mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_BUILD);
+	    mr_query_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
+	    
+	    mr_query_request.setAttribute(GSXML.TO_ATT, to);
+	    
+	    // paramList
+	    Element query_param_list = (Element) doc_.importNode(cgi_param_list, true);
+	    mr_query_request.appendChild(query_param_list);
+	    
+	    Element mr_query_response = (Element)mr_.process(mr_query_message);
+	    Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
+	    // append the response to the page
+	    page.appendChild(doc_.importNode(result_response, true));
+	}
 
-	// the first part of the data for the page is the cgi-params
-	Element cgi_request = (Element)doc_.importNode(request, true);
-	page.appendChild(cgi_request);
+	// another part of the page is the service description
 
-	// the second part of the page is the param list for the service
-	// request the service info for the selected service - should be cached?
-	
+	// request the service info for the selected service - should be cached
 	Element mr_info_message = doc_.createElement(GSXML.MESSAGE_ELEM);
 	Element mr_info_request = doc_.createElement(GSXML.REQUEST_ELEM);
 	mr_info_message.appendChild(mr_info_request);
 	mr_info_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);
+	mr_info_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
 
-	String to = "build"; // knwo this cos its build action - loaded by a cluster called build
-	to = GSPath.appendLink(to, service_name);
 	mr_info_request.setAttribute(GSXML.TO_ATT, to);
-
+	
 	Element mr_info_response = (Element) mr_.process(mr_info_message);
-	System.err.println("describe response for service");
-	System.err.println(converter_.getString(mr_info_response));
-	Element description = doc_.createElement(GSXML.DESCRIPTION_ELEM);
-	// just param list for now - may need content info too
 
 	String path = GSXML.RESPONSE_ELEM;
 	path = GSPath.appendLink(path, GSXML.SERVICE_ELEM);
-	path = GSPath.appendLink(path, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
+	Element description = (Element)doc_.importNode(GSXML.getNodeByPath(mr_info_response, path), true);
 
-	Node pl = GSXML.getNodeByPath(mr_info_response, path);
-	if (pl ==null) {
-	    System.out.println("pl is null");
-	}
-	else {
-	    System.out.println("pl name is "+pl.getNodeName());
-	}
-	Element imported_paramList = (Element)doc_.importNode(pl, true);
-	// convert the name to short
-	cgi_.addShortNames(imported_paramList);
+	Element pl = (Element)GSXML.getChildByTagName(description, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
+	
+	if (pl !=null) {
+	    // add short names to the params in the param list
+	    cgi_.addShortNames(pl);
 
-	description.appendChild(imported_paramList);
-	
-	// for each param in page_request, set the current value if present
-	//actually, prob dont need to know the default value, just which one to display - overwrite the default att?
-	
-	Element param = (Element)imported_paramList.getFirstChild();
-	while (param !=null) {
-	    if (param.getNodeName().equals(GSXML.PARAM_ELEM)) { // just in case
-		String name = param.getAttribute(GSXML.NAME_ATT);
-		String current = (String)params.get(name);
-		if (current !=null && !current.equals("")) {
-		    param.setAttribute(GSXML.DEFAULT_ATT, current);
+	    // for each param in the description, overwrite teh default value with the currently set value if present 
+	    Element param = (Element)pl.getFirstChild();
+	    while (param !=null) {
+		if (param.getNodeName().equals(GSXML.PARAM_ELEM)) { // just in case
+		    String name = param.getAttribute(GSXML.NAME_ATT);
+		    String current = (String)params.get(name);
+		    if (current !=null && !current.equals("")) {
+			param.setAttribute(GSXML.DEFAULT_ATT, current);
+		    }
 		}
-	    }
-	    param = (Element)param.getNextSibling();
-	}
-	
-	cgi_request.appendChild(description);
-	
-	// now see if we need to actually do anything - only if a colleciton has been set
-	String collection = (String)params.get("collection");
-	if (collection == null || collection.equals("")) {
-	    // no coll set - just output the form
-	    
-	    Document style_doc = converter_.getDOM(new File(stylesheet));
-	    GSXSLT.absoluteIncludePaths(style_doc, config_);
-	    return transformer_.transform(style_doc, page);       
-	}
-	
-	// else do the request, output search box and results
-	Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM);
-	Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM);
-	mr_query_message.appendChild(mr_query_request);
-
-	mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_BUILD);
-	mr_query_request.setAttribute(GSXML.TO_ATT, to);
-
-	// paramList
-	Element paramList = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	mr_query_request.appendChild(paramList);
-
-	Iterator i = params.entrySet().iterator();
-	while (i.hasNext()) {
-	    Map.Entry e = (Map.Entry)i.next();
-	    String name = cgi_.toLong((String)e.getKey());
-	    if (!name.equals("")) {
-		String value = (String)e.getValue();
-	    // if (!name.equals("c")) {
-		Element p = doc_.createElement(GSXML.PARAM_ELEM);
-		p.setAttribute(GSXML.NAME_ATT, name);
-		p.setAttribute(GSXML.VALUE_ATT, value);
-		paramList.appendChild(p);
-		// }
+		param = (Element)param.getNextSibling();
 	    }
 	}
+	page.appendChild(description);
+
+  	// part of the data for the page is the cgi-params
+	// if we have this here, do we need to do the previous step?
+	Element cgi_request = (Element)doc_.importNode(request, true);
+	page.appendChild(cgi_request);
 	
-	Element mr_query_response = (Element)mr_.process(mr_query_message);
 
-	// this result is a message
-	Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
-	page.appendChild(doc_.importNode(result_response, true));
-
+	// now process the page and return the result
 	Document style_doc = converter_.getDOM(new File(stylesheet));
 	
 	GSXSLT.absoluteIncludePaths(style_doc, config_);
-	return transformer_.transform(style_doc, page);    
+	return (Element)transformer_.transform(style_doc, page);    
     }     
 }
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/PageAction.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/PageAction.java	(revision 3567)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/PageAction.java	(revision 3568)
@@ -14,22 +14,21 @@
 public class PageAction extends Action {
 
-    public String process (Element message) {
+    public Element process (Element message) {
 	
-	Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0);
+	Element request = (Element) GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM);
 	// the page name is the subaction
 	String page_name = request.getAttribute(GSXML.SUBACTION_ATT);
-
+	if (page_name.equals("")) { // if no page specified, assume home page
+	    page_name = "home";
+	}
+	
 	// create the return page tree
 	Element page = doc_.createElement(GSXML.PAGE_ELEM);
-	page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT));
-	// add the lang stuff from xml_in
-	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true));
-	// add the system stuff from xml_in
+	page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
+	// add the lang stuff from message
+	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.DISPLAY_ELEM), true));
+	// add the system stuff from message
 	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
-
-	if (page_name.equals("")) {
-	    // for now send an error. change to always display the home page?
-	    return GSHTML.errorPage(" page action specified, but no page specified");
-	}
+	
 	if (page_name.equals("home")) {
 	    return homePage(page, request);
@@ -37,53 +36,59 @@
 	    return aboutPage(page, request);
 	} else {
-	    return GSHTML.errorPage("page: "+page_name+" not yet implemented");
+	    System.err.println("PageAction Error: unimplemented page specified!");
+	    return null; 
 	}
     }
-
-
-    protected String homePage(Element page, Element orig_message) {
+    
+    protected Element homePage(Element page, Element orig_message) {
 	
-	// first, get the list of collections from mr
-	
+	// first, get the message router info
 	Element coll_list_message = doc_.createElement(GSXML.MESSAGE_ELEM);
-	coll_list_message.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
 	Element coll_list_request = doc_.createElement(GSXML.REQUEST_ELEM);
 	coll_list_message.appendChild(coll_list_request);
 	coll_list_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);
-	//coll_list_request.setAttribute("info", "collectionList");
-	
+	coll_list_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
+	System.out.println("PageAction: getting mesage router description.");
 	Element coll_list_response = (Element)mr_.process(coll_list_message);
 	if (coll_list_response==null) {
-	    return GSHTML.errorPage("couldn't query the mr about collections");
+	    System.err.println("PageAction Error: couldn't query the message router!");
+	    return null;
 	}
 	
-	// second, get the metadata for each collection
+	// second, get the metadata for each collection - we only want specific
+	// elements but for now, we'll just get it all
 	NodeList colls = coll_list_response.getElementsByTagName(GSXML.COLLECTION_ELEM);
-	
-	//Element metadata_message = doc_.createElement(GSXML.MESSAGE_ELEM);
-	//metadata_message.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
-	//Element metadata_request = doc_.createElement(GSXML.REQUEST_ELEM);
-	//metadata_message.appendChild(metadata_request);
-	//metadata_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);	
+	// we will send all the requests in a single message
+	Element metadata_message = doc_.createElement(GSXML.MESSAGE_ELEM);
 	for (int i=0; i<colls.getLength(); i++) {
-	    Element metadata_message = doc_.createElement(GSXML.MESSAGE_ELEM);
-	    metadata_message.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
 	    Element metadata_request = doc_.createElement(GSXML.REQUEST_ELEM);
+	    metadata_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);	
+	    metadata_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
+	    Element c = (Element)colls.item(i);
+	    String name = c.getAttribute(GSXML.NAME_ATT);	    
+	    metadata_request.setAttribute(GSXML.TO_ATT, name); // overwrites the old value	
+	    // add this request to the message
 	    metadata_message.appendChild(metadata_request);
-	    metadata_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);	
-	
-	    // get the metadata for each one
-	    Element c = (Element)colls.item(i);
-	    String name = c.getAttribute(GSXML.NAME_ATT);
-	    System.out.println("getting metadata for coll "+name);
-	    
-	    metadata_request.setAttribute(GSXML.TO_ATT, name); // overwrites the old value
-	    System.out.println("metadata message = \n"+converter_.getString(metadata_message));
-	    Element metadata_response = (Element)mr_.process(metadata_message);
-	    Element coll = (Element)metadata_response.getElementsByTagName(GSXML.COLLECTION_ELEM).item(0);
-	    if (coll==null) {
-		System.out.println("coll is null, in \n"+converter_.getString(metadata_response));
+	}
+	System.out.println("PageAction: getting metadata for each collection.");
+	Element metadata_response = (Element)mr_.process(metadata_message);
+
+	NodeList coll_responses = metadata_response.getElementsByTagName(GSXML.COLLECTION_ELEM);
+	// check that have same number of responses as collections
+	if (colls.getLength() != coll_responses.getLength()) {
+	    System.err.println("PageAction Error: didn't get a response for each collection - somethings gone wrong!");
+	    // for now, dont use the metadata
+	} else {
+	    for (int i=0; i<colls.getLength(); i++) {
+		Element c1 = (Element)colls.item(i);
+		Element c2 = (Element)coll_responses.item(i);
+		if (c1.getAttribute(GSXML.NAME_ATT).equals(c2.getAttribute(GSXML.NAME_ATT))) {
+		    // add the metadata to the original response   
+		    GSXML.mergeMetadataLists(c1, c2); // add the metadata to the original response   
+		} else {
+		    System.err.println("PageAction Error: response does not correspond to request!");
+		} 
+		
 	    }
-	    GSXML.mergeMetadataLists(c, coll); // add the metadata to the original response
 	}
 
@@ -96,17 +101,12 @@
 	Document style_doc = converter_.getDOM(new File(stylesheet));
 	GSXSLT.absoluteIncludePaths(style_doc, config_);
-	//System.out.println("page=");
-	//System.out.println(converter_.getString(page));
-	return transformer_.transform(style_doc, page);    
+	return (Element)transformer_.transform(style_doc, page);    	
 	
-    	     
     } // homePage
 
-    protected String aboutPage(Element page, Element request) {
+    protected Element aboutPage(Element page, Element request) {
 
 	// extract the params from the cgi-request, 
-	// first convert short to long names
 	Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	cgi_.toLong(cgi_paramList);
 	HashMap params = GSXML.extractParams(cgi_paramList);
 	
@@ -116,19 +116,18 @@
 	}
 	if (coll_name == null || coll_name.equals("")) {
-	    return GSHTML.errorPage("about page - need to specify coll name or cluster name");
+	    System.err.println("PageAction Error: about page requested with no collection or cluster specified!");
+	    return null;
 	}
-
+	
+	// get the collection or cluster description
 	Element coll_about_message = doc_.createElement(GSXML.MESSAGE_ELEM);
-	coll_about_message.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
-
 	Element coll_about_request = doc_.createElement(GSXML.REQUEST_ELEM);
 	coll_about_message.appendChild(coll_about_request);
 	coll_about_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);
 	coll_about_request.setAttribute(GSXML.TO_ATT, coll_name);
-
+	coll_about_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
+	
 	Element coll_about_response = (Element)mr_.process(coll_about_message);
 
-	//	System.out.println("coll response=");
-	//System.out.println(converter_.getString(coll_about_response));
 	// add the response to the page 
 	page.appendChild(doc_.importNode(GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM), true));
@@ -138,5 +137,5 @@
 	Document style_doc = converter_.getDOM(new File(stylesheet));
 	GSXSLT.absoluteIncludePaths(style_doc, config_);
-	return transformer_.transform(style_doc, page);    
+	return (Element)transformer_.transform(style_doc, page);    
 
 	
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java	(revision 3567)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java	(revision 3568)
@@ -5,4 +5,5 @@
 // XML classes
 import org.w3c.dom.Node; 
+import org.w3c.dom.NodeList; 
 import org.w3c.dom.Text; 
 import org.w3c.dom.Document; 
@@ -11,23 +12,23 @@
 import java.util.HashMap;
 import java.util.Map;
-//import java.util.Map;
 import java.util.Iterator;
 import java.io.File;
 
+/** action class for queries */
 public class QueryAction extends Action {
     
-
-    public String process (Element message) {
-
+    public Element process (Element message) {
+
+	// get the request - assume there is only one
+	Element request = (Element)GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM);
 
 	// create the return page tree
 	Element page = doc_.createElement(GSXML.PAGE_ELEM);
-	page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT));
+	page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
 	// add the lang stuff from message
-	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true));
+	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.DISPLAY_ELEM), true));
 	// add the system stuff from message
-	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
-
-	Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0);
+       page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
+
 	// query type is teh subaction
 	String query_type = request.getAttribute(GSXML.SUBACTION_ATT);
@@ -49,33 +50,29 @@
     
     // we may be able to generalize this for all query types?
-    protected String textQuery(Element page, Element request) {
-
-	// chack that the stylesheet is present - cant output a page without one. we may adapt this to use unknownquery stylesheet? - or ask for one from the MR
+    protected Element textQuery(Element page, Element request) {
+
+	// check that the stylesheet is present - cant output a page without one. we may adapt this to use unknownquery stylesheet? - or ask for one from the MR
 	String stylesheet = GSFile.stylesheetFile(config_, "textquery.xsl");
 	if (stylesheet==null) {
-	    return GSHTML.errorPage("textquery stylesheet not found!");
+	    System.err.println("QueryAction Error: textquery stylesheet not found!");
+	    return null;
 	}
 
 	// extract the params from the cgi-request, and check that we have a coll specified
-	// first convert short to long names
-	Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	cgi_.toLong(cgi_paramList);
-	HashMap params = GSXML.extractParams(cgi_paramList);
+	Element cgi_param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
+	HashMap params = GSXML.extractParams(cgi_param_list);
 
 	String collection = (String)params.get("collection");
 	if (collection == null || collection.equals("")) {
-	    return GSHTML.errorPage("textquery, need to specify a colleciton!");
-	}
-
-	// the first part of the data for the page is the cgi-params
-	Element cgi_request = (Element)doc_.importNode(request, true);
-	page.appendChild(cgi_request);
-
-	// get the service info from the MR - this will probably need to be cached somehow later on. and add as a description node to the cgi-request - this doesn't work. change to add the specified value as a current attribute to the param - need to do somthing different for query
-
+	    System.err.println("QueryAction Error: no colleciton was specified!");
+	    return null; 
+	}
+
+	// get the service info from the MR - this will probably need to be cached somehow later on. and add the service node to the page 
 	Element mr_info_message = doc_.createElement(GSXML.MESSAGE_ELEM);
 	Element mr_info_request = doc_.createElement(GSXML.REQUEST_ELEM);
 	mr_info_message.appendChild(mr_info_request);
 	mr_info_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE);
+	mr_info_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
 
 	String to = collection;
@@ -84,28 +81,16 @@
 
 	Element mr_info_response = (Element) mr_.process(mr_info_message);
-	System.err.println("describe response for service");
-	System.err.println(converter_.getString(mr_info_response));
-	Element description = doc_.createElement(GSXML.DESCRIPTION_ELEM);
-	// just param list for now - may need content info too
+
 	String path = GSXML.RESPONSE_ELEM;
 	path = GSPath.appendLink(path, GSXML.SERVICE_ELEM);
-	path = GSPath.appendLink(path, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	Node pl = GSXML.getNodeByPath(mr_info_response, path);
-	if (pl ==null) {
-	    System.out.println("pl is null");
-	}
-	else {
-	    System.out.println("pl name is "+pl.getNodeName());
-	
-	    Element imported_paramList = (Element)doc_.importNode(pl, true);
-	    // convert the name to short
-	    cgi_.addShortNames(imported_paramList);
-
-	    description.appendChild(imported_paramList);
-	
-	    // for each param in page_request, set the current value if present
-	    //actually, prob dont need to know the default value, just which one to display - overwrite the default att?
-	    
-	    Element param = (Element)imported_paramList.getFirstChild();
+	Element description = (Element)doc_.importNode(GSXML.getNodeByPath(mr_info_response, path), true);
+	Element pl = (Element)GSXML.getChildByTagName(description, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
+	
+	if (pl !=null) {
+	    // add short names to the params in the param list
+	    cgi_.addShortNames(pl);
+
+	    // for each param in the description, overwrite teh default value with the currently set value if present 
+	    Element param = (Element)pl.getFirstChild();
 	    while (param !=null) {
 		if (param.getNodeName().equals(GSXML.PARAM_ELEM)) { // just in case
@@ -119,120 +104,109 @@
 	    }
 	}
-	cgi_request.appendChild(description);
+    
+	// part of the data for the description is the cgi-params
+	// if we have this here, do we need to do the previous step?
+	Element cgi_request = (Element)doc_.importNode(request, true);
+	page.appendChild(cgi_request);
+
+	page.appendChild(description);
 	
 	// check the query string
 	String query = (String)params.get(GSXML.REQUEST_TYPE_QUERY);
 
-	if (query==null|| query.equals("")) {
-	    // if there is no q set, just output the search form
-
-	    Document style_doc = converter_.getDOM(new File(stylesheet));
-	    GSXSLT.absoluteIncludePaths(style_doc, config_);
-	    return transformer_.transform(style_doc, page);       
-	}
-	
-	// else do the request, output search box and results
-	Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM);
-	Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM);
-	mr_query_message.appendChild(mr_query_request);
-
-	mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY);
-	mr_query_request.setAttribute(GSXML.TO_ATT, to);
-
-	// paramList
-	Element paramList = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	mr_query_request.appendChild(paramList);
-
-	Iterator i = params.entrySet().iterator();
-	while (i.hasNext()) {
-	    Map.Entry e = (Map.Entry)i.next();
-	    String name = cgi_.toLong((String)e.getKey());
-	    if (!name.equals("")) {
-		String value = (String)e.getValue();
-	    // if (!name.equals("c")) {
-		Element p = doc_.createElement(GSXML.PARAM_ELEM);
-		p.setAttribute(GSXML.NAME_ATT, name);
-		p.setAttribute(GSXML.VALUE_ATT, value);
-		paramList.appendChild(p);
-		// }
+	if (query!=null&& !query.equals("")) {
+	    // do the query
+	    
+	    Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM);
+	    Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM);
+	    mr_query_message.appendChild(mr_query_request);
+
+	    mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY);
+	    mr_query_request.setAttribute(GSXML.TO_ATT, to);
+	    mr_query_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
+	    // paramList
+	    // should we remove the query from the param list?
+	    Element query_param_list = (Element)doc_.importNode(cgi_param_list, true);
+	    mr_query_request.appendChild(query_param_list);
+	    
+	    // content - contains the query string
+	    Element query_content = GSXML.createTextElement(doc_, GSXML.CONTENT_ELEM, query);
+	    mr_query_request.appendChild(query_content);
+	    
+	    Element mr_query_response = (Element)mr_.process(mr_query_message);
+	    
+	    // this result is the list of docs.
+	    // now take that list, and get the Titles
+	    // for now, just create a whole new request
+	    
+	    // check that there are some resources - for now check the list, but later should use a numdocs metadata elem
+	    path = GSXML.RESPONSE_ELEM;
+	    path = GSPath.appendLink(path, GSXML.CONTENT_ELEM);
+	    path = GSPath.appendLink(path, GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER);
+	    
+	    Element resource_list = (Element)GSXML.getNodeByPath(mr_query_response,
+								 path); // resourceList not present if no docs found
+	    if (resource_list == null) {
+		
+		Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
+	    
+		page.appendChild(doc_.importNode(result_response, true));
+		
+		Document style_doc = converter_.getDOM(new File(stylesheet));
+		GSXSLT.absoluteIncludePaths(style_doc, config_);
+		return (Element)transformer_.transform(style_doc, page);    
+		
 	    }
-	}
-
-	// content - contains the query string
-	Element query_content = doc_.createElement(GSXML.CONTENT_ELEM);
-	Text query_text = doc_.createTextNode(query);
-	query_content.appendChild(query_text);
-	mr_query_request.appendChild(query_content);
-	
-	Element mr_query_response = (Element)mr_.process(mr_query_message);
-
-	// this result is the list of docs.
-	// now take that list, and get the Titles
-	// for now, just create a whole new request
-
-	// check that there are some resources - for now check the list, but later should use a numdocs metadata elem
-	path = GSXML.RESPONSE_ELEM;
-	path = GSPath.appendLink(path, GSXML.CONTENT_ELEM);
-	path = GSPath.appendLink(path, GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER);
-
-	Element resource_list = (Element)GSXML.getNodeByPath(mr_query_response,
-							     path); // resourceList not present if no docs found
-	if (resource_list == null) {
-
-	    Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
+	    
+	    // we have a doc list, so get the metadata - for now, get title.
+	    // can we dynamically decide what metadata to get?
+	    Element mr_metadata_message = doc_.createElement(GSXML.MESSAGE_ELEM);
+	    Element mr_metadata_request = doc_.createElement(GSXML.REQUEST_ELEM);
+	    mr_metadata_message.appendChild(mr_metadata_request);
+	    
+	    mr_metadata_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY);
+	    mr_metadata_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
+	    to = GSPath.appendLink(collection, "MetadataRetrieve");
+	    mr_metadata_request.setAttribute(GSXML.TO_ATT, to);
+	    
+	    Element meta_content = doc_.createElement(GSXML.CONTENT_ELEM);
+	    mr_metadata_request.appendChild(meta_content);
+	    
+	    // the first part of the content is the doc list
+	    meta_content.appendChild(doc_.importNode(resource_list, true));
+	    
+	    // the second part of the content is the metadata list
+	    Element metadata_list = doc_.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
+	    Element title = doc_.createElement(GSXML.METADATA_ELEM);
+	    title.setAttribute(GSXML.NAME_ATT, "Title");
+	    metadata_list.appendChild(title);
+	    meta_content.appendChild(metadata_list);
+
+	    Element mr_metadata_response = (Element)mr_.process(mr_metadata_message);
+	    
+	    Element result_response = (Element)GSXML.getChildByTagName(mr_metadata_response, GSXML.RESPONSE_ELEM);
 	    
 	    page.appendChild(doc_.importNode(result_response, true));
-
-	    Document style_doc = converter_.getDOM(new File(stylesheet));
-	    GSXSLT.absoluteIncludePaths(style_doc, config_);
-	    return transformer_.transform(style_doc, page);    
-
-	}
-
-	// we have a doc list, so get the metadata - for now, get title.
-	// can we dynamically decide what metadata to get?
-	// get the Title metadata
-	Element mr_metadata_message = doc_.createElement(GSXML.MESSAGE_ELEM);
-	Element mr_metadata_request = doc_.createElement(GSXML.REQUEST_ELEM);
-	mr_metadata_message.appendChild(mr_metadata_request);
-
-	mr_metadata_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY);
-	to = GSPath.appendLink(collection, "MetadataRetrieve");
-	mr_metadata_request.setAttribute(GSXML.TO_ATT, to);
-	
-	Element meta_content = doc_.createElement(GSXML.CONTENT_ELEM);
-	mr_metadata_request.appendChild(meta_content);
-
-	// the first part of the content is the doc list
-	meta_content.appendChild(doc_.importNode(resource_list, true));
-
-	// the second part of the content is the metadata list
-	Element metadata_list = doc_.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
-	Element title = doc_.createElement(GSXML.METADATA_ELEM);
-	title.setAttribute(GSXML.NAME_ATT, "Title");
-	metadata_list.appendChild(title);
-	meta_content.appendChild(metadata_list);
-
-	Element mr_metadata_response = (Element)mr_.process(mr_metadata_message);
-	
-	Element result_response = (Element)GSXML.getChildByTagName(mr_metadata_response, GSXML.RESPONSE_ELEM);
-	
-	page.appendChild(doc_.importNode(result_response, true));
-	
+	
+	} // do teh query
+
+	
+	// output the page
 	// process using the stylesheet
 	Document style_doc = converter_.getDOM(new File(stylesheet));
 	GSXSLT.absoluteIncludePaths(style_doc, config_);
-	return transformer_.transform(style_doc, page);    
-	
-    }
-
-    protected String fieldQuery(Element page, Element request) {
-	return GSHTML.errorPage("field query not implemented");
-
-
-    }
-    protected String unknownQuery(Element page, Element request, String query_type) {
-
-	return GSHTML.errorPage("unknown query subtype - "+query_type+" query not implemented");
+	return (Element)transformer_.transform(style_doc, page);    
+	
+    }
+
+    protected Element fieldQuery(Element page, Element request) {
+	String p =  GSHTML.errorPage("field query not implemented");
+
+	return converter_.getDOM(p).getDocumentElement();
+    }
+    protected Element unknownQuery(Element page, Element request, String query_type) {
+
+	String p =  GSHTML.errorPage("unknown query subtype - "+query_type+" query not implemented");
+	return null;//converter_.getDOM(p).getDocumentElement();
     }
 }
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/ResourceAction.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/ResourceAction.java	(revision 3567)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/action/ResourceAction.java	(revision 3568)
@@ -11,42 +11,38 @@
 import java.io.File;
 
+/** Action class for retrieving Documents or Resources via the message router
+ */
 public class ResourceAction extends Action {
-
-
-    // could pass in action name, and have it dynamically decide the name
-   
-    public String process (Element message) {
-
+  
+    public Element process (Element message) {
+	
 	// find the stylesheet
 	String stylesheet = GSFile.stylesheetFile(config_, "resource.xsl");
 
 	if (stylesheet==null) {
-	    return GSHTML.errorPage("resource stylesheet not found!");
+	    System.err.println("ResourceAction Error: resource stylesheet not found!");
+	    return null;
 	}
-
+	
 	// for now, no subaction eventually we may want to have subactions such as text assoc or something ?
 	
-	Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0);
-
+	// get the request - assume only one
+	Element request = (Element)GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM);
 	Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
-	cgi_.toLong(cgi_paramList);
 	HashMap params = GSXML.extractParams(cgi_paramList);
 
 	String resource_name = (String)params.get("resource");
 	if (resource_name == null || resource_name.equals("")) {
-	    // no doc to show
-	    return GSHTML.errorPage("no resource specified");
+	    System.err.println("ResourceAction Error: no resource specified!");
+	    return null;
 	}
-	
-	
+		
 	// create the return page tree
 	Element page = doc_.createElement(GSXML.PAGE_ELEM);
-	page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT));
+	page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
 	// add the lang stuff from message
-	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true));
+	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.DISPLAY_ELEM), true));
 	// add the config stuff from message
 	page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true));
-
-
 
 	// build up the mr request
@@ -55,4 +51,5 @@
 	mr_message.appendChild(mr_request);
 	mr_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY);
+	mr_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT));
 	mr_request.setAttribute("resourceType", "core");
 	String to = (String)params.get("collection"); // collection name
@@ -82,5 +79,5 @@
 	Document style_doc = converter_.getDOM(new File(stylesheet));
 	GSXSLT.absoluteIncludePaths(style_doc, config_);
-	return transformer_.transform(style_doc, page);    
+	return (Element)transformer_.transform(style_doc, page);    
 
     }
