Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java	(revision 25986)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java	(revision 25987)
@@ -739,5 +739,5 @@
 		}
 
-		GSXSLT.inlineImportAndIncludeFiles(skinAndLibraryDoc, null);
+		GSXSLT.inlineImportAndIncludeFiles(skinAndLibraryDoc, null, (String) this.config_params.get(GSConstants.INTERFACE_NAME));
 		skinAndLibraryDoc = (Document) secondConfigFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request));
 
@@ -864,39 +864,43 @@
 			name = this.xslt_map.get(action);
 		}
-		// now find the absolute path
-		ArrayList<File> stylesheets = GSFile.getStylesheetFiles(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, name);
-		if (stylesheets.size() == 0)
-		{
-			logger.error(" Can't find stylesheet for " + name);
-			return null;
-		}
-		logger.debug("Stylesheet: " + name);
-
-		Document finalDoc = this.converter.getDOM(stylesheets.get(stylesheets.size() - 1), "UTF-8");
-		if (finalDoc == null)
-		{
-			return null;
-		}
-
-		for (int i = stylesheets.size() - 2; i >= 0; i--)
-		{
-			Document currentDoc = this.converter.getDOM(stylesheets.get(i), "UTF-8");
-			if (currentDoc == null)
-			{
-				return null;
-			}
-
-			if (_debug)
-			{
-				GSXSLT.mergeStylesheetsDebug(finalDoc, currentDoc.getDocumentElement(), true, true, stylesheets.get(stylesheets.size() - 1).getAbsolutePath(), stylesheets.get(i).getAbsolutePath());
-			}
-			else
-			{
-				GSXSLT.mergeStylesheets(finalDoc, currentDoc.getDocumentElement(), true);
-			}
-		}
-
+
+		Document finalDoc = GSXSLT.mergedXSLTDocumentCascade(name, (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, _debug);
 		return finalDoc;
 	}
+	// 	// now find the absolute path
+	// 	ArrayList<File> stylesheets = GSFile.getStylesheetFiles(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, name);
+	// 	if (stylesheets.size() == 0)
+	// 	{
+	// 		logger.error(" Can't find stylesheet for " + name);
+	// 		return null;
+	// 	}
+	// 	logger.debug("Stylesheet: " + name);
+
+	// 	Document finalDoc = this.converter.getDOM(stylesheets.get(stylesheets.size() - 1), "UTF-8");
+	// 	if (finalDoc == null)
+	// 	{
+	// 		return null;
+	// 	}
+
+	// 	for (int i = stylesheets.size() - 2; i >= 0; i--)
+	// 	{
+	// 		Document currentDoc = this.converter.getDOM(stylesheets.get(i), "UTF-8");
+	// 		if (currentDoc == null)
+	// 		{
+	// 			return null;
+	// 		}
+
+	// 		if (_debug)
+	// 		{
+	// 			GSXSLT.mergeStylesheetsDebug(finalDoc, currentDoc.getDocumentElement(), true, true, stylesheets.get(stylesheets.size() - 1).getAbsolutePath(), stylesheets.get(i).getAbsolutePath());
+	// 		}
+	// 		else
+	// 		{
+	// 			GSXSLT.mergeStylesheets(finalDoc, currentDoc.getDocumentElement(), true);
+	// 		}
+	// 	}
+
+	// 	return finalDoc;
+	// }
 
 	// returns the path to the gslib.xsl file that is applicable for the current interface
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXSLT.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXSLT.java	(revision 25986)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXSLT.java	(revision 25987)
@@ -29,7 +29,12 @@
 import org.w3c.dom.NodeList;
 
+import org.apache.log4j.*;
+
 /** various functions for manipulating Greenstone xslt */
 public class GSXSLT
 {
+
+	static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.GSXSLT.class.getName());
+
 	public static void mergeStylesheets(Document main_xsl, Element extra_xsl, boolean overwrite)
 	{
@@ -215,10 +220,10 @@
 	}
 
-	public static void inlineImportAndIncludeFiles(Document doc, String pathExtra)
-	{
-		inlineImportAndIncludeFilesDebug(doc, pathExtra, false, null);
-	}
-
-	public static void inlineImportAndIncludeFilesDebug(Document doc, String pathExtra, boolean debug, String docFileName)
+  public static void inlineImportAndIncludeFiles(Document doc, String pathExtra, String interface_name)
+	{
+	  inlineImportAndIncludeFilesDebug(doc, pathExtra, false, null, interface_name);
+	}
+
+  public static void inlineImportAndIncludeFilesDebug(Document doc, String pathExtra, boolean debug, String docFileName, String interface_name)
 	{
 		XMLConverter converter = new XMLConverter();
@@ -233,5 +238,6 @@
 			Element current = (Element) ((i < importList.getLength()) ? importList.item(i) : includeList.item(i - importList.getLength()));
 			String href = current.getAttribute("href");
-			String filePath = GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), "default") + File.separator + "transform" + File.separator + path.replace("/", File.separator) + href.replace("/", File.separator);
+			String filePath = GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), interface_name) + File.separator + "transform" + File.separator + path.replace("/", File.separator) + href.replace("/", File.separator);
+			//String filePath = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), site_name, collection, interface_name, base_interfaces, 
 
 			try
@@ -247,5 +253,5 @@
 
 				//Do this recursively
-				inlineImportAndIncludeFilesDebug(inlineDoc, newPath, debug, filePath);
+				inlineImportAndIncludeFilesDebug(inlineDoc, newPath, debug, filePath, interface_name);
 
 				GSXSLT.mergeStylesheetsDebug(doc, inlineDoc.getDocumentElement(), false, debug, docFileName, filePath);
@@ -269,4 +275,44 @@
 		}
 	}
+
+		public static Document mergedXSLTDocumentCascade(String xslt_filename, String site, String collection, String this_interface, ArrayList<String> base_interfaces, boolean debug) {
+		  XMLConverter converter = new XMLConverter();
+		  // find the list of stylesheets with this name
+		  ArrayList<File> stylesheets = GSFile.getStylesheetFiles(GlobalProperties.getGSDL3Home(), site, collection, this_interface, base_interfaces, xslt_filename);
+		if (stylesheets.size() == 0)
+		{
+			logger.error(" Can't find stylesheet for " + xslt_filename);
+			return null;
+		}
+		logger.debug("Stylesheet: " + xslt_filename);
+
+		Document finalDoc = converter.getDOM(stylesheets.get(stylesheets.size() - 1), "UTF-8");
+		if (finalDoc == null)
+		{
+			return null;
+		}
+
+		for (int i = stylesheets.size() - 2; i >= 0; i--)
+		{
+			Document currentDoc = converter.getDOM(stylesheets.get(i), "UTF-8");
+			if (currentDoc == null)
+			{
+				return null;
+			}
+
+			if (debug)
+			{
+				GSXSLT.mergeStylesheetsDebug(finalDoc, currentDoc.getDocumentElement(), true, true, stylesheets.get(stylesheets.size() - 1).getAbsolutePath(), stylesheets.get(i).getAbsolutePath());
+			}
+			else
+			{
+				GSXSLT.mergeStylesheets(finalDoc, currentDoc.getDocumentElement(), true);
+			}
+		}
+
+		return finalDoc;
+	}
+
+
 
 	public static void modifyConfigFormatForDebug(Document doc, String fileName)
