Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java	(revision 25346)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java	(revision 25347)
@@ -21,4 +21,5 @@
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Locale;
@@ -485,3 +486,40 @@
 		return c.createRecaptchaHtml(null, null);
 	}
+
+    public static String getInterfaceStringsAsJavascript(String interface_name, String lang, String prefix, String prependToPrefix) {	
+	StringBuffer outputStr = new StringBuffer();
+	
+	Dictionary dict = new Dictionary("interface_" + interface_name, lang);
+	Enumeration keys = dict.getKeys();	
+	if(keys == null) { // try default interface
+	    logger.error("****** Interface name: " + interface_name + " does not have any keys. Trying interface_default.");
+	    dict = new Dictionary("interface_default", lang);
+	    keys = dict.getKeys();
+	}
+	
+	// get all properties in the language-specific dictionary with the given key prefix
+	// Create a string of prependToPrefix.key= "value";\n
+
+	while(keys.hasMoreElements()) {	    
+	    String key = (String)keys.nextElement();
+	    if(key.startsWith(prefix)) {
+		String value = getInterfaceText(interface_name, lang, key);
+
+		outputStr.append(prependToPrefix);
+		outputStr.append(".");
+		outputStr.append(key);
+		outputStr.append("=\"");
+		outputStr.append(value);
+		outputStr.append("\";\n");
+	    }
+	}	
+	
+	return outputStr.toString();
+	
+    }
+
+
+    public static void main(String args[]) {
+	System.out.println("\n@@@@@\n" + XSLTUtil.getInterfaceStringsAsJavascript("default", "en", "dse", "gs.text") + "@@@@@\n");
+    }
 }
Index: /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/header.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/header.xsl	(revision 25346)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/header.xsl	(revision 25347)
@@ -391,44 +391,14 @@
 		</xsl:if>
 	</xsl:template>
-	
+
+	<!-- gslib:langfrag should get expanded in ../util.xsl -->
 	<xsl:template name="document-editor-language-fragments">
-		<script type="text/javascript">
-			<xsl:text disable-output-escaping="yes">
-				gs.text = new Array();
-				gs.text.dse = new Array();
-				gs.text.dse.no_docs="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.no_docs')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.untitled="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.untitled')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.delete_section="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.delete_section')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.edit="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.edit')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.hide="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.hide')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.add_sub_section="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.add_sub_section')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.duplicate="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.duplicate')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.error_saving="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.error_saving')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.save_changes="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.save_changes')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.saving="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.saving')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.modifying_archives="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.modifying_archives')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.empty_collection_list="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.empty_collection_list')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.could_not_build_p1="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.could_not_build_p1')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.could_not_build_p2="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.could_not_build_p2')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.could_not_activate_p1="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.could_not_activate_p1')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.could_not_activate_p2="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.could_not_activate_p2')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.activating="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.activating')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.building="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.building')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.could_not_check_status_p1="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.could_not_check_status_p1')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.could_not_check_status_p2a="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.could_not_check_status_p2a')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.could_not_check_status_p2b="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.could_not_check_status_p2b')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.error_saving_changes="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.error_saving_changes')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.error_code="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.error_code')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.error_reason="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.error_reason')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.error_line="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.error_line')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.xml_error="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.xml_error')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.browse_cannot_validate_xml="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.browse_cannot_validate_xml')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.add_new_metadata="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.add_new_metadata')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.no_value_given="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.no_value_given')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.create_new_document="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.create_new_document')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.untitled_section="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.untitled_section')"/><xsl:text disable-output-escaping="yes">";
-				gs.text.dse.insert_new_section="</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'dse.insert_new_section')"/><xsl:text disable-output-escaping="yes">";
-			</xsl:text>
-		</script>
+	  <!--<gslib:langfrag name="dse"/>-->
+
+	  <script type="text/javascript">
+	  gs.text = new Array();
+	  gs.text.dse = new Array();
+	  <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, 'dse', 'gs.text')"/>
+	  </script>
 	</xsl:template>
 	
Index: /main/trunk/greenstone3/web/interfaces/oran/transform/util.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/util.xsl	(revision 25346)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/util.xsl	(revision 25347)
@@ -677,4 +677,14 @@
     </a>
   </xsl:template>
-  
+
+  <!-- needs to be name=attrvalue else xsl:param -->
+  <!-- call function with the name prefix (e.g. dse) and the file -->
+  <xsl:template name="langfrag">
+    <script type="text/javascript">      
+      gs.text = new Array();
+      gs.text.<xsl:value-of select="@name"/> = new Array();
+      <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, @name, 'gs.text')"/>
+    </script>
+  </xsl:template>
+
 </xsl:stylesheet>
