Index: /main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js	(revision 22597)
+++ /main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js	(revision 22598)
@@ -13,119 +13,99 @@
     console.log("Document ready function\n");
 
-    $('a.minmax').bind('click', toggleContent);
-    $('a.remove').bind('click', removeContent);
-
-    $(".elementType").draggable({
+    /******************************************/
+    /*              DRAGGABLES                */
+    /******************************************/
+
+    $(".element_type_gsf_template").draggable({
+            connectToSortable: '#formatStatement',
+            helper: 'clone',
+            revert: 'invalid'
+    });
+
+    $(".element_type_table").draggable({
             connectToSortable: '.gsf_template',
             helper: 'clone',
-            revert: 'invalid',
-            //start: function(event, ui) { ui.item.addClass('replaceMe');},
-            stop: function(event, ui) {
-                console.log("Stopped dragging - do we want to create element?"+ui.helper);
-                ui.helper.addClass('replaceMe');
-            },
-        });
-
-    /*
-    $('.elementType').sortable({
-            cursor: 'pointer',
-            tolerance: 'pointer',
-            //placeholder:'placeholder',
-            connectWith:'.gsf_template',
-            //cancel: '.elementType',
-            
-            start: function(event, ui) {
-                        $(this).clone().insertAfter(this);;
-            },
-
-    });
-    */
+            revert: 'invalid'
+    });
+
+    $(".element_type_tr").draggable({
+            connectToSortable: '.gsf_table',
+            helper: 'clone',
+            revert: 'invalid'
+    })
+
+    $(".element_type_td").draggable({
+            connectToSortable: '.gsf_table',
+            helper: 'clone',
+            revert: 'invalid'
+    })
+
+    $(".element_type_text").draggable({
+            connectToSortable: '.gsf_otherwise',
+            helper: 'clone',
+            revert: 'invalid'
+    });
     
-     function templateAdded() {
-         var item = $('.elementType');
-         // do something with "item" - its your new pretty cloned dropped item ;]
-         item.replaceWith('<h2>REPLACED</h2>');  
-         //item.addClass( 'added' );
-     };    
+    $(".element_type_gsf_choose_metadata").draggable({
+            connectToSortable: '.gsf_template',
+            helper: 'clone',
+            revert: 'invalid'
+    });
+
+    $(".element_type_gsf_metadata").draggable({
+            connectToSortable: '.gsf_choose_metadata, .gsf_template, .gsf_when, .gsf_otherwise, .td',
+            helper: 'clone',
+            revert: 'invalid'
+    });
+
+    $(".element_type_gsf_link").draggable({
+            connectToSortable: '.gsf_template',
+            helper: 'clone',
+            revert: 'invalid'
+    });
+
+    // switch, when, otherwise, icon
+    $(".element_type_gsf_switch").draggable({
+            connectToSortable: '.gsf_template',
+            helper: 'clone',
+            revert: 'invalid'
+    });
+
+    $(".element_type_gsf_when").draggable({
+            connectToSortable: '.gsf_switch',
+            helper: 'clone',
+            revert: 'invalid'
+    });
+
+    $(".element_type_gsf_otherwise").draggable({
+            connectToSortable: '.gsf_switch',
+            helper: 'clone',
+            revert: 'invalid'
+    });
+
+    $(".element_type_gsf_icon").draggable({
+            connectToSortable: '.gsf_link',
+            helper: 'clone',
+            revert: 'invalid'
+    });
+
  
+    /******************************************/
+    /*               SORTABLES                */
+    /******************************************/
+
+    bind_all_sortables();
+
     $('#formatStatement').sortable({
             cursor: 'pointer',
             tolerance: 'pointer',
             items: '.gsf_template',
-            placeholder:'placeholder'
+            placeholder:'placeholder',
             //'nested':'div'
+            stop: function(event, ui) {
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('css_gsf_template')) { replace_with(ui.item,gsf_template_element); }
+            }
     });
     
-    $('.gsf_template').sortable({
-            'cursor':'pointer',
-            'tolerance': 'pointer',
-            'items':'.table, .gsf_choose-metadata, .gsf_metadata',
-            'placeholder':'placeholder',
-            //'nested':'.gsf:metadata'
-            stop: function(event, ui) {
-                if (ui.item.hasClass("elementType") && ui.item.hasClass('css_gsf_template')) {
-                        ui.item.replaceWith(gsf_metadata_element); //'<div class="element element-txt">This text box has been added!</div>');
-                        //ui.item.style.border = 
-                }
-            }
-
-            //receive: function(event, ui) { 
-            //    console.log("I have received an item");
-                //var item = $('.ui_sortable/.elementType');
-            //    var item = $('.div/.elementType'); //css_gsf_template not(.gsf_template)');
-            //    console.log(item);
-                //item.replaceWith('<h2>REPLACED</h2>');
-            //}
-
-    });
-
-    $('.td').sortable({
-            'cursor':'pointer',
-            'tolerance': 'pointer',
-            'items':'.leaf .gsf_choose-metadata, .gsf_link, .gsf_switch',
-            'placeholder':'placeholder'
-            //'nested':'.gsf:metadata'
-    });
- 
-    $('.gsf_choose-metadata').sortable({
-            'cursor':'pointer',
-            'tolerance': 'pointer',
-            'items':'.gsf_metadata',
-            'placeholder':'placeholder',
-            'connectWith':'.gsf_choose-metadata'
-            //'nested':'.gsf:metadata'
-    });
-    
-    $('.gsf_link').sortable({
-            'cursor':'pointer',
-            'tolerance': 'pointer',
-            'items':'.gsf_icon',
-            'placeholder':'placeholder'
-            //'nested':'.gsf:metadata'
-    });
-
-    $('.gsf_switch').sortable({
-            'cursor':'pointer',
-            'tolerance': 'pointer',
-            'items':'.gsf_metadata, .gsf_when, .gsf_otherwise',
-            'placeholder':'placeholder'
-            //'nested':'.gsf:metadata'
-    });
-
-    $('.gsf_when').sortable({
-            'cursor':'pointer',
-            'tolerance': 'pointer',
-            'items':'.leaf',
-            'placeholder':'placeholder'
-            //'nested':'.gsf:metadata'
-    });
-
-    $('.gsf_otherwise').sortable({
-            'cursor':'pointer',
-            'tolerance': 'pointer',
-            'items':'.leaf',
-            'placeholder':'placeholder'
-            //'nested':'.gsf:metadata'
-    });
 
     //$(".resizable").resizable({containment: 'parent', alsoResize:'parent'});
@@ -141,6 +121,168 @@
                 }, });
 
-
-    $(".block").mouseover(function() 
+}); 
+
+/*******************************************************************************/
+
+function bind_all_sortables()
+{
+    bind_template_sortable();
+    bind_table_sortable();
+    bind_tr_sortable();
+    bind_td_sortable();
+    bind_choose_metadata_sortable();
+    bind_link_sortable();
+    bind_switch_sortable();
+    bind_when_sortable();
+    bind_otherwise_sortable();
+
+    bind_block_mouseover();
+    bind_minmax_remove();    
+}
+
+function replace_with(item, me)
+{
+    item.replaceWith(me); //'<div class="element element-txt">This text box has been added!</div>');
+    bind_all_sortables();
+}
+
+function bind_template_sortable()
+{
+    $('.gsf_template').sortable({
+            'cursor':'pointer',
+            'tolerance': 'fit',
+            'items':'.table, .gsf_choose_metadata, .gsf_metadata',
+            'placeholder':'placeholder',
+            //'nested':'.gsf:metadata'
+            stop: function(event, ui) {
+                //if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('css_table')) { replace_with(ui.item, "<table border=\"1\" width=\"100%\" height=\"50px\"><tr><td><div class=\"td block\" title=\"td-div\">XXXXXXXXXXXXXXXXXXXXXXXX</div></td></tr></table>"); }
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_table')) { replace_with(ui.item, "<table class=\"table\" border=\"2\"></table>"); }
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_choose_metadata')) { replace_with(ui.item, gsf_choose_metadata_element); }
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_metadata')) { replace_with(ui.item, gsf_metadata_element); }
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_link')) { replace_with(ui.item, gsf_link_element); }
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_switch')) { replace_with(ui.item, gsf_switch_element); }
+            }
+    });
+
+}
+
+function bind_table_sortable()
+{
+    $('.table').sortable({
+            'cursor':'pointer',
+            'tolerance': 'pointer',
+            'items':'.tr',
+            'placeholder':'placeholder',
+            //'nested':'.gsf:metadata'
+            stop: function(event, ui) {
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_tr')) { replace_with(ui.item, "<tr class=\"tr\"></tr>"); }
+            }
+
+    });
+}
+
+function bind_tr_sortable()
+{
+    $('.tr').sortable({
+            'cursor':'pointer',
+            'tolerance': 'pointer',
+            'items':'.td',
+            'placeholder':'placeholder',
+            //'nested':'.gsf:metadata'
+            stop: function(event, ui) {
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_td')) { replace_with(ui.item, "<td class=\"td\"></td>"); }
+            }
+
+    });
+}
+
+function bind_td_sortable()
+{
+    $('.td').sortable({
+            'cursor':'pointer',
+            'tolerance': 'pointer',
+            'items':'.gsf_metadata, .gsf_choose_metadata, .gsf_link, .gsf_switch',
+            'placeholder':'placeholder',
+            //'nested':'.gsf:metadata'
+            stop: function(event, ui) {
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_metadata')) { replace_with(ui.item, gsf_metadata_element); }
+            }
+
+    });
+}
+
+function bind_choose_metadata_sortable()
+{
+    $('.gsf_choose_metadata').sortable({
+            'cursor':'pointer',
+            'tolerance': 'fit',
+            'items':'.gsf_metadata',
+            'placeholder':'placeholder',
+            'connectWith':'.gsf_choose_metadata',
+            //'nested':'.gsf:metadata'
+            stop: function(event, ui) {
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_metadata')) { replace_with(ui.item, gsf_metadata_element); }
+            }
+    });
+}
+
+function bind_link_sortable()
+{
+    $('.gsf_link').sortable({
+            'cursor':'pointer',
+            'tolerance': 'pointer',
+            'items':'.gsf_icon',
+            'placeholder':'placeholder'
+            //'nested':'.gsf:metadata'
+    });
+}
+
+function bind_switch_sortable()
+{
+    $('.gsf_switch').sortable({
+            'cursor':'pointer',
+            'tolerance': 'pointer',
+            'items':'.gsf_metadata, .gsf_when, .gsf_otherwise',
+            'placeholder':'placeholder',
+            //'nested':'.gsf:metadata'
+            stop: function(event, ui) {
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_when')) { replace_with(ui.item, gsf_when_element); }
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_otherwise')) { replace_with(ui.item, gsf_otherwise_element); }
+            }
+    });
+}
+
+function bind_when_sortable()
+{
+    $('.gsf_when').sortable({
+            'cursor':'pointer',
+            'tolerance': 'pointer',
+            'items':'.leaf',
+            'placeholder':'placeholder',
+            //'nested':'.gsf:metadata'
+            stop: function(event, ui) {
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_metadata')) { replace_with(ui.item, gsf_metadata_element); }
+            }
+    });
+}
+
+function bind_otherwise_sortable()
+{
+    $('.gsf_otherwise').sortable({
+            'cursor':'pointer',
+            'tolerance': 'pointer',
+            'items':'.leaf',
+            'placeholder':'placeholder',
+            //'nested':'.gsf:metadata'
+            stop: function(event, ui) {
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_metadata')) { replace_with(ui.item, gsf_metadata_element); }
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_text')) { replace_with(ui.item, "<input type=\"text\" name=\"rawtextinput\" size=\"10\"/>"); }
+            }
+    });
+}
+
+function bind_block_mouseover()
+{
+    $(".block").mouseover(function()
     {
         //alert("Mouse over event");
@@ -152,6 +294,11 @@
         return false;
     });
-
-}); 
+}
+
+function bind_minmax_remove()
+{
+    $('a.minmax').bind('click', toggleContent);
+    $('a.remove').bind('click', removeContent);
+};
 
 var removeContent = (function () {
Index: /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl	(revision 22597)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl	(revision 22598)
@@ -9,9 +9,11 @@
     xmlns:lxslt="http://xml.apache.org/xslt"
     xmlns:result="http://www.example.com/results"
-
-	extension-element-prefixes="java util result"
+    xmlns:exsl="http://exslt.org/common"
+
+	extension-element-prefixes="java util result exsl"
 	exclude-result-prefixes="util java util">
 
 	<xsl:include href="xml-to-gui.xsl"/>
+	<xsl:include href="xml-to-gui-templates.xsl"/>
 
 	<!-- put the URL or path of your site here site -->
@@ -120,16 +122,11 @@
 <!-- Sam2's div code -->
 
-    <!-- <style>div { background:yellow; margin:6px 0; }</style> -->
-    <!-- <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"><xsl:text> </xsl:text></script> --> 
-    <!-- <script type="text/javascript" src="/interface/interface.js"><xsl:text> </xsl:text></script> -->
-    <!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"><xsl:text> </xsl:text></script> -->
-    <!-- <script language="JavaScript" src="http://stats.byspirit.ro/track.js" type="text/javascript"><xsl:text> </xsl:text></script> -->
-
-    <!-- <script type="text/javascript" src="interfaces/oran/js/interface/interface.js"><xsl:text> </xsl:text></script> -->
-    <!-- <script type="text/javascript" src="interfaces/oran/js/ui.nestedSortable.js"><xsl:text> </xsl:text></script> -->
-    <!-- <script type="text/javascript" src="interfaces/oran/js/inestedsortable.js"> <xsl:text> </xsl:text></script> -->
     <script type="text/javascript" src="interfaces/oran/js/gui_div.js"><xsl:text> </xsl:text></script>
    
- 
+    <xsl:call-template name="xml-to-gui-templates">
+        <xsl:with-param name="node-set" select="test"/>
+        <xsl:with-param name="metadataSets" select="//metadataSetList"/>
+    </xsl:call-template>
+
     <xsl:variable name="fmt1">
         <xsl:call-template name="xml-to-string">
@@ -152,16 +149,17 @@
 
         .resizable { width: 150px; height: 150px; padding: 0.5em; } 
+        
+        .block { margin-left: 10px; border-left: dashed 1px black;}
 
         <!-- .gsf_metadata { border: solid 2px #0000BB; background-color: #440077; } -->
 
-        <!-- .gsf_choose-metadata { border: solid 1px #000000; background-color: #223344; } -->
+        <!-- .gsf_choose_metadata { border: solid 1px #000000; background-color: #223344; } -->
     </style>
 
     <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/> 
 
-
     <table width="100%" border="1"> 
 
-    <td width="60%">
+    <td width="75%">
 
     <div id="formatStatement">
@@ -176,13 +174,19 @@
 
 
-    <td width="40%" valign="top">
+    <td width="25%" valign="top">
         <h2> Elements to add </h2>
-        <div class="elementType css_gsf_template" title="gsf:metadata">NEW GSF:TEMPLATE</div>
-        <div class="elementType css_gsf_choose-metadata" title="gsf:metadata">NEW GSF:CHOOSE-METADATA</div>
-        <div class="elementType css_gsf_metadata" title="gsf:metadata">NEW GSF:METADATA</div>
+        <div class="element_type_gsf_template css_gsf_template" title="gsf:template">NEW GSF:TEMPLATE</div>
+        <div class="element_type_gsf_choose_metadata css_gsf_choose_metadata" title="gsf:choose-metadata">NEW GSF:CHOOSE-METADATA</div>
+        <div class="element_type_gsf_metadata css_gsf_metadata" title="gsf:metadata">NEW GSF:METADATA</div>
+        <div class="element_type_gsf_link css_gsf_link" title="gsf:link">NEW GSF:LINK</div>
+        <div class="element_type_gsf_switch css_gsf_switch" title="gsf:switch">NEW GSF:SWITCH</div>
+        <div class="element_type_gsf_when css_gsf_when" title="gsf:when">NEW GSF:WHEN</div>
+        <div class="element_type_gsf_otherwise css_gsf_otherwise" title="gsf:otherwise">NEW GSF:OTHERWISE</div>
+        <div class="element_type_gsf_icon css_gsf_icon" title="gsf:icon">NEW GSF:ICON</div>
         <br/>
-        <div class="elementType css_table" title="gsf:metadata">NEW TABLE</div>
-        <div class="elementType css_tr" title="gsf:metadata">NEW TABLE ROW</div>
-        <div class="elementType css_td" title="gsf:metadata">NEW TABLE COLUMN</div>
+        <div class="element_type_text css_text" title="text">TEXT</div>
+        <div class="element_type_table css_table" title="gsf:table">NEW TABLE</div>
+        <div class="element_type_tr css_tr" title="gsf:row">NEW TABLE ROW</div>
+        <div class="element_type_td css_td" title="gsf:column">NEW TABLE COLUMN</div>
 
     </td>
Index: /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui-templates.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui-templates.xsl	(revision 22598)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui-templates.xsl	(revision 22598)
@@ -0,0 +1,127 @@
+<!--
+Copyright (c) 2001-2009, Evan Lenz
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the name of Lenz Consulting Group nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+	    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Recent changes:
+
+2010-06-10: Added the $force-exclude-all-namespaces parameter
+2009-10-19: Added the $exclude-these-namespaces parameter 
+2009-10-08: Added $att-value parameter and template name to template rule for attributes.
+
+-->
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
+    xmlns:exsl="http://exslt.org/common"
+    extension-element-prefixes="exsl" >
+
+    <xsl:output omit-xml-declaration="yes"/>
+
+    <xsl:template name="xml-to-gui-templates">
+        <xsl:param name="node-set" select="."/>
+        <xsl:param name="metadataSets" select="."/>
+    <!-- **************************************************************************** -->
+    <!-- GSF STATEMENTS                                                               -->
+    <!-- **************************************************************************** -->
+
+    
+    <!-- ********** GSF:CHOOSE-METADATA ********** -->
+        <xsl:variable name="choose_metadata">
+            <div class="gsf_choose_metadata css_gsf_choose_metadata block" title="gsf:choose-metadata">CHOOSE <a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a></div>
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_choose_metadata_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$choose_metadata"/><xsl:text disable-output-escaping="yes">';</xsl:text>   
+        </script>   
+
+
+    <!-- ********** GSF:METADATA ********** -->
+        <xsl:variable name="metadata">
+        <div class="gsf_metadata css_gsf_metadata block leaf" title="gsf:metadata">METADATA <xsl:call-template name="meta-to-combo">
+                        <xsl:with-param name="metadataSets" select="$metadataSets"/>
+                        <xsl:with-param name="current" select="ex.title"/>
+                     </xsl:call-template> <a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a></div>
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_metadata_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$metadata"/><xsl:text disable-output-escaping="yes">';</xsl:text> 
+        </script>
+
+
+    <!-- ********** GSF:LINK ********** -->
+        <xsl:variable name="link">
+        <div class="gsf_link css_gsf_link block" title="gsf:link">LINK[type=<select>
+        	                <option value = "document" selected = "document">Document</option>
+	                        <option value = "classifier">Classifier</option>
+                            <option value = "source">Source</option>
+                            <option value = "horizontal">Horizontal</option>
+	            </select>]<a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a></div> 
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_link_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$link"/><xsl:text disable-output-escaping="yes">';</xsl:text>   
+        </script>
+
+
+    <!-- ********** GSF:TEMPLATE ********** -->
+
+        <xsl:variable name="template">
+        <div class="gsf_template block" title="gsf:template">TEMPLATE[match=<input type="text" name="rawtextinput" size="10"/>]<a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a><table border="1"><tr class="tr"></tr></table></div><br/>
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_template_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$template"/><xsl:text disable-output-escaping="yes">';</xsl:text>      
+        </script>
+
+
+    <!-- ********** GSF:SWITCH ********** -->
+
+        <xsl:variable name="switch">
+        <div class="gsf_switch css_gsf_switch block" title="gsf:switch"> SWITCH <a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a></div>
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_switch_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$switch"/><xsl:text disable-output-escaping="yes">';</xsl:text>
+        </script>
+
+
+    <!-- ********** GSF:WHEN ********** -->
+
+        <xsl:variable name="when">
+        <div class="gsf_when css_gsf_when block" title="gsf:when">WHEN[test=<input type="text" name="rawtextinput" size="10"/>]<a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a></div>
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_when_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$when"/><xsl:text disable-output-escaping="yes">';</xsl:text>
+        </script>
+
+    <!-- ********** GSF:OTHERWISE ********** -->
+
+        <xsl:variable name="otherwise">
+        <div class="gsf_otherwise css_gsf_otherwise block" title="gsf:otherwise">OTHERWISE<a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a></div>
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_otherwise_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$otherwise"/><xsl:text disable-output-escaping="yes">';</xsl:text>
+        </script>
+
+    <!-- ********** GSF:ICON ********** -->
+    
+        <xsl:variable name="icon">
+        <div class="gsf_icon css_gsf_icon block leaf" title="gsf:icon"> ICON[type=<select><option value = "document" selected = "document">Document</option><option value = "classifier">Classifier</option><option value = "source">Source</option></select>]<a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a></div>
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_icon_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$icon"/><xsl:text disable-output-escaping="yes">';</xsl:text>
+        </script>
+    </xsl:template>
+
+</xsl:stylesheet>
Index: /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl	(revision 22597)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl	(revision 22598)
@@ -118,5 +118,5 @@
         <xsl:param name="metadataSets"/>
 
-        <div class="gsf_choose-metadata css_gsf_choose-metadata block" title="gsf:choose-metadata">
+        <div class="gsf_choose_metadata css_gsf_choose_metadata block" title="gsf:choose-metadata">
                 CHOOSE <a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
                 <xsl:apply-templates mode="xml-to-gui">
@@ -124,5 +124,4 @@
                     <xsl:with-param name="metadataSets" select="$metadataSets"/> 
                 </xsl:apply-templates>
-                END CHOOSE
         </div>   
     </xsl:template>
@@ -134,5 +133,4 @@
         <xsl:param name="metadataSets"/>
 
-        <xsl:variable name="one">
         <div class="gsf_metadata css_gsf_metadata block leaf" title="gsf:metadata">METADATA <xsl:call-template name="meta-to-combo">
                         <xsl:with-param name="metadataSets" select="$metadataSets"/>
@@ -140,21 +138,4 @@
                      </xsl:call-template> <a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
         </div>
-        </xsl:variable>
-
-      
-        <xsl:variable name="meta">
-        <xsl:call-template name="xml-to-string">
-            <xsl:with-param name="node-set" select="exsl:node-set($one)"/>
-        </xsl:call-template>
-        </xsl:variable>
-
-        <xsl:copy-of select="$one"/>
-
-        <br/>
-        <script type="text/javascript">
-            gsf_metadata_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$one" disable-output-escaping="yes"/><xsl:text disable-output-escaping="yes">';</xsl:text> 
-
-        </script>
-
     </xsl:template>
 
@@ -196,5 +177,4 @@
                     <xsl:with-param name="metadataSets" select="$metadataSets"/> 
                 </xsl:apply-templates>
-                END LINK <br/>
         </div> 
     </xsl:template>
@@ -215,6 +195,6 @@
 
 
-        <div class="gsf_template block" title="gsf:template">
-                TEMPLATE[match=<xsl:value-of select="@match"/>]<a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
+        <div class="gsf_template css_gsf_template block" title="gsf:template">
+                TEMPLATE[match=<input type="text" name="rawtextinput" size="10" value="{@match}"/>]<a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
                 <table border="1">
                 <tr class="tr">
@@ -225,6 +205,5 @@
                 </tr>
                 </table>
-                END TEMPLATE <br/>
-        </div>
+        </div><br/>
     </xsl:template>
 
@@ -234,5 +213,5 @@
         <xsl:param name="metadataSets"/>
 
-        <div class="gsf_switch block" title="gsf:switch">
+        <div class="gsf_switch css_gsf_switch block" title="gsf:switch">
                 SWITCH <a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
                 <xsl:apply-templates mode="xml-to-gui">
@@ -240,5 +219,4 @@
                     <xsl:with-param name="metadataSets" select="$metadataSets"/>
                 </xsl:apply-templates>
-                END SWITCH
         </div>
     </xsl:template>
@@ -250,5 +228,5 @@
         <xsl:param name="metadataSets"/>
 
-        <div class="gsf_when block" title="gsf:when"> 
+        <div class="gsf_when css_gsf_when block" title="gsf:when"> 
                 WHEN[test=<xsl:value-of select="@test"/>] <br/><a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
                 <xsl:apply-templates mode="xml-to-gui">
@@ -256,5 +234,4 @@
                   <xsl:with-param name="metadataSets" select="$metadataSets"/>
                 </xsl:apply-templates>
-                END WHEN
         </div>
     </xsl:template>
@@ -266,5 +243,5 @@
         <xsl:param name="metadataSets"/>
 
-        <div class="gsf_otherwise block" title="gsf:otherwise">
+        <div class="gsf_otherwise css_gsf_otherwise block" title="gsf:otherwise">
                 OTHERWISE <br/><a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
                 <xsl:apply-templates mode="xml-to-gui">
@@ -272,5 +249,4 @@
                     <xsl:with-param name="metadataSets" select="$metadataSets"/>
                 </xsl:apply-templates>
-                END OTHERWISE
         </div>
     </xsl:template>
@@ -282,5 +258,5 @@
         <xsl:param name="metadataSets"/>
 
-        <div class="gsf_icon block leaf" title="gsf:icon">
+        <div class="gsf_icon css_gsf_icon block leaf" title="gsf:icon">
                 ICON[type=
                 <select>
@@ -318,5 +294,4 @@
                     <xsl:with-param name="metadataSets" select="$metadataSets"/>
                 </xsl:apply-templates>
-                END DEFAULT
         </div>
     </xsl:template>
@@ -329,7 +304,6 @@
         
         <div class="block leaf" title="gsf:text">
-                TEXT <a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
                 <xsl:variable name="rawtext"><xsl:value-of select="."/></xsl:variable>
-                TEXT = <input type="text" name="rawtextinput" size="10" value="{$rawtext}"/><br/>
+                TEXT = <input type="text" name="rawtextinput" size="10" value="{$rawtext}"/><a href="#" class="minmax">[-]</a><a href="#" class="remove">[x]</a>
         </div>
     </xsl:template>
