[fusion-commits] r1385 - in trunk: . common/php lib text/en

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Apr 25 14:44:42 EDT 2008


Author: madair
Date: 2008-04-25 14:44:42 -0400 (Fri, 25 Apr 2008)
New Revision: 1385

Added:
   trunk/configHeader.json
   trunk/lib/SingleFile.js
   trunk/parseAppDef.xsl
Modified:
   trunk/build.xml
   trunk/common/php/Utilities.php
   trunk/common/php/Xml2JSON.php
   trunk/lib/ApplicationDefinition.js
   trunk/lib/fusion.js
   trunk/text/en/strings.json
Log:
re #53:
- builds all of fusion in a single file
- will parse an AppDef file for required Widget and Map js files and include only those files in the SF build.xml
- converts AppDef to a JSON structure and includes it
- add YUI compression

Modified: trunk/build.xml
===================================================================
--- trunk/build.xml	2008-04-23 15:33:00 UTC (rev 1384)
+++ trunk/build.xml	2008-04-25 18:44:42 UTC (rev 1385)
@@ -79,6 +79,7 @@
   <property name="deploy.home" value="${env.HTDOCS}/${app.name}"/>
   <property name="dist.home" value="${basedir}/dist"/>
   <property name="docs.home" value="${build.home}/docs"/>
+  <property name="appDef" value="${basedir}/templates/mapguide/standard/ApplicationDefinition.xml"/>
 
 
 <!-- ==================== External Dependencies =========================== -->
@@ -89,6 +90,7 @@
   -->
 
   <property name="jx-lib"  value="jx"/>
+  <property name="YUIcompressor"  value="C:\YUI\yuicompressor-2.3.5\build\yuicompressor-2.3.5.jar"/>
 
 
 <!-- ==================== Prepare Target ================================== -->
@@ -113,6 +115,7 @@
     <copy todir="${build.home}">
       <fileset dir="${basedir}" 
             includes="config.json 
+                      configHeader.json
                       MapGuide/** 
                       MapServer/** 
                       common/** 
@@ -120,8 +123,6 @@
                       docs/** 
                       ext/** 
                       lib/** 
-                      redist/** 
-                      samples/** 
                       templates/** 
                       text/** 
                       widgets/**"
@@ -172,6 +173,66 @@
   </target>
   -->
 
+<!-- =================== single file build ================================== -->
+
+  <target description="single file build" name="singleFile" depends="prepare">
+    <echo message="preparing single file build for ${appDef}"/>
+    <delete dir="${build.home}/lib/fusionSF.js"/>
+    <delete dir="${build.home}/appDefFileset.xml"/>
+    
+    <!-- generate the list of fiels for this Application and load as a property -->
+    <xslt in="${appDef}" 
+          out="${build.home}/appDefFileset.xml"
+          style="${basedir}/parseAppDef.xsl">
+      <param name="buildHome" expression="${build.home}"/>
+    </xslt>
+    <xmlproperty file="${build.home}/appDefFileset.xml"/>
+    
+    <!-- convert the application definition file to JSON -->
+    <exec executable="php" os="Windows Vista, Windows XP" 
+              dir="${build.home}\common\php" 
+              output="${build.home}/appDef.json">
+        <arg line="Xml2JSON.php --file='${appDef}'"/>
+    </exec>
+    
+    <!-- now merge everything into a single file -->
+    <concat destfile="${build.home}/lib/fusionSF.js" outputencoding="UTF-8">
+        <filelist dir="${build.home}/lib" 
+                  files=" SingleFile.js
+                          fusion.js
+                          OpenLayers/OpenLayers.js
+                          ../jx/lib/jx_combined.js
+                          excanvas/excanvas.js
+                          Error.js 
+                          EventMgr.js
+                          ApplicationDefinition.js
+                          MGBroker.js 
+                          Widget.js 
+                          ButtonBase.js 
+                          MenuBase.js
+                          ButtonTool.js 
+                          CanvasTool.js 
+                          ClickTool.js 
+                          RectTool.js 
+                          Search.js
+                          Map.js"
+        />
+        <!--fileset dir="${build.home}/MapGuide" includes="*.js" excludesfile="MapGuide/MapGuideViewerApi.js"/>
+        <fileset dir="${build.home}/MapServer" includes="*.js"/-->
+        <fileset dir="${build.home}/text" includes="**/*.json"/>
+        <filelist dir="${build.home}" files="${AppDef.Maps}"/>
+        <filelist dir="${build.home}" files="${AppDef.Widgets}"/>
+        <filelist dir="${build.home}" files="appDef.json configHeader.json config.json"/>
+    </concat>
+    <echo message="compressing..."/>
+    <java jar="${YUIcompressor}" fork="true"
+          output="${build.home}/lib/fusionSF-compressed.js">
+        <arg value="${build.home}/lib/fusionSF.js"/>
+    </java>
+    <!--exec executable="jsmin.exe" os="Windows Vista, Windows XP" 
+      input="${build.home}/lib/fusionSF.js" output="${build.home}/lib/fusionSF-compressed.js"/-->
+  </target>
+
   
 <!-- =================== Compress Target ================================== -->
 
@@ -179,8 +240,8 @@
     <echo message="Concatenating into -lib version"/>
     <concat destfile="${build.home}/lib/fusion-combined.js" outputencoding="UTF-8">
         <filelist dir="${build.home}/lib" 
-        files=" utils.js 
-                Error.js 
+        files=" Error.js 
+                EventMgr.js
                 ApplicationDefinition.js
                 MGBroker.js 
                 Widget.js 

Modified: trunk/common/php/Utilities.php
===================================================================
--- trunk/common/php/Utilities.php	2008-04-23 15:33:00 UTC (rev 1384)
+++ trunk/common/php/Utilities.php	2008-04-25 18:44:42 UTC (rev 1385)
@@ -241,4 +241,23 @@
 
     return $szResult;
 }
+
+function arguments($argv) {
+    $_ARG = array();
+    foreach ($argv as $arg) {
+        if (ereg('--[a-zA-Z0-9]*=.*',$arg)) {
+            $str = split("=",$arg); $arg = '';
+            $key = ereg_replace("--",'',$str[0]);
+            for ( $i = 1; $i < count($str); $i++ ) {
+                $arg .= $str[$i];
+            }
+                        $_ARG[$key] = $arg;
+        } elseif(ereg('-[a-zA-Z0-9]',$arg)) {
+            $arg = ereg_replace("-",'',$arg);
+            $_ARG[$arg] = 'true';
+        }
+    }
+    return $_ARG;
+}
+
 ?>
\ No newline at end of file

Modified: trunk/common/php/Xml2JSON.php
===================================================================
--- trunk/common/php/Xml2JSON.php	2008-04-23 15:33:00 UTC (rev 1384)
+++ trunk/common/php/Xml2JSON.php	2008-04-25 18:44:42 UTC (rev 1385)
@@ -30,15 +30,31 @@
 
 if (isset($_FILES['xml'])) {
     $xml = file_get_contents($_FILES['xml']['tmp_name']);
-} else {
+} elseif (isset($_SERVER['HTTP_HOST'])) {
     $REQUEST_VARS = array_merge($_GET, $_POST);
-
     if (!isset($REQUEST_VARS['xml'])) {
         die('xml not set');
     }
-
     $xml = rawurldecode ($REQUEST_VARS['xml']);
     $xml = str_replace('\"', '"', $xml);
+    header('Content-type: text/plain');
+    header('X-JSON: true');
+} elseif (isset($argv)) {
+    $cliArgs = arguments($argv);
+    if (isset($cliArgs['obj'])) {
+        $jsObject = $cliArgs['obj'];
+    } else {
+        $jsObject = "Fusion.appDefJson";
+    }
+    if (isset($cliArgs['file'])) {
+        $xml = file_get_contents($cliArgs['file']);
+        if (!$xml) {
+            die('file not found:'.$cliArgs['file']);
+        }
+        echo $jsObject."=";
+    }
+} else {
+    die('no XML input');
 }
 //print_r($xml);
 $document = DOMDocument::loadXML($xml);
@@ -46,8 +62,5 @@
     die ('/* invalid xml document:'.$xml.' */');
 }
 $root = $document->documentElement;
-
-header('Content-type: text/plain');
-header('X-JSON: true');
-echo '{"' . $root->tagName . '":' . xml2json($root) . '}';
+echo '{"' . $root->tagName . '":' . xml2json($root) . '};';
 ?>
\ No newline at end of file

Added: trunk/configHeader.json
===================================================================
--- trunk/configHeader.json	                        (rev 0)
+++ trunk/configHeader.json	2008-04-25 18:44:42 UTC (rev 1385)
@@ -0,0 +1 @@
+Fusion.configuration=
\ No newline at end of file

Modified: trunk/lib/ApplicationDefinition.js
===================================================================
--- trunk/lib/ApplicationDefinition.js	2008-04-23 15:33:00 UTC (rev 1384)
+++ trunk/lib/ApplicationDefinition.js	2008-04-25 18:44:42 UTC (rev 1385)
@@ -116,7 +116,12 @@
         
         if ( (this.applicationDefinition.match('Library://') == null) &&
              (this.applicationDefinition.match('Session:') == null) ) {
-            Fusion.getXmlAsJson(this.applicationDefinition, OpenLayers.Function.bind(this.parseAppDef, this));
+            if (Fusion.appDefJson) {
+                this.parseAppDef(Fusion.appDefJson);
+            } else {
+                Fusion.getXmlAsJson(this.applicationDefinition, 
+                              OpenLayers.Function.bind(this.getAppDefCB, this));
+            }
         } else {
             //TODO: request as JSON format
             if (!this.sessionId) {
@@ -138,9 +143,16 @@
       r.parameters.session = this.sessionId;
       this.oBroker.dispatchRequest(r, 
             OpenLayers.Function.bind(Fusion.xml2json, this, 
-                  OpenLayers.Function.bind(this.parseAppDef, this)));
+                  OpenLayers.Function.bind(this.getAppDefCB, this)));
     },
     
+    getAppDefCB: function(xhr) {
+        var o;
+        eval("o="+xhr.responseText);
+        this.parseAppDef(o);
+        Fusion.setLoadState(Fusion.LOAD_WIDGETS);
+    },
+
     /**
      * Function: parseAppDef
      *
@@ -150,10 +162,8 @@
      *
      * the XmlHttpRequest object
      */
-     parseAppDef: function(xhr) {
-        var o;
-        eval("o="+xhr.responseText);
-        var appDef = o.ApplicationDefinition;
+    parseAppDef: function(json) {
+        var appDef = json.ApplicationDefinition;
 
         /* Set the application title */
         if (appDef.Title) {
@@ -213,7 +223,6 @@
             }
             
         }
-        Fusion.setLoadState(Fusion.LOAD_WIDGETS);
     },
     
     /**

Added: trunk/lib/SingleFile.js
===================================================================
--- trunk/lib/SingleFile.js	                        (rev 0)
+++ trunk/lib/SingleFile.js	2008-04-25 18:44:42 UTC (rev 1385)
@@ -0,0 +1,9 @@
+/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
+ * license.  See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+var Fusion = {
+    singleFile: true
+};
+
+

Modified: trunk/lib/fusion.js
===================================================================
--- trunk/lib/fusion.js	2008-04-23 15:33:00 UTC (rev 1384)
+++ trunk/lib/fusion.js	2008-04-25 18:44:42 UTC (rev 1385)
@@ -232,7 +232,7 @@
         var sessionIdParam = this.getQueryParam('Session');
         this.sessionId = sessionIdParam || (options.sessionId || null);
         
-        if (options.applicationDefinition) {
+        if (options.applicationDefinitionURL) {
             this.applicationDefinitionURL = options.applicationDefinitionURL;            
         } else {
             var queryAppDef = this.getQueryParam('ApplicationDefinition');
@@ -242,62 +242,46 @@
                 this.applicationDefinitionURL = 'ApplicationDefinition.xml';
             }
         }
-        
+        if (Fusion._singleFile) {
+            //override this method since OL is loaded in the fusion file
+            OpenLayers._getScriptLocation = function() {
+                return Fusion.fusionURL + 'lib/OpenLayers/';
+            }
+        }
         this.initializeLocale();
 
         this.sWebagentURL = "";
         this.sScriptLang = "";
-        this.configuration = {};
 
-        /* determine the URL to fusion based on the script tag
-         * that was used to load this file
-         */
-        var aScripts = document.getElementsByTagName('SCRIPT');
-        for (var i=0; i<aScripts.length; i++) {
-            var s = aScripts[i].src;
-            var n = s.indexOf('lib/fusion.js');
-            if (n != -1) {
-                this.fusionURL = s.substring(0,n);
-                if (this.fusionURL.indexOf("http://")<0) {
-                  if (this.fusionURL.slice(0,1) == "/") {
-                    this.fusionURL = window.location.protocol + "//" + window.location.host + this.fusionURL;
-                  } else {
-                    var newLoc = window.location.href;
-                    if (newLoc.slice(-1) != "/") {
-                      newLoc = newLoc.slice(0,newLoc.lastIndexOf("?"));
-                      newLoc = newLoc.slice(0,newLoc.lastIndexOf("/")+1);
-                    }
-                    this.fusionURL = newLoc + this.fusionURL;
-                  }
-                } 
-                /*
+        /*
                  * if the application has been loaded from the same host as
                  * fusion is installed in, then technically we don't need to
                  * use the redirect script because we conform to the 
                  * Same Origin Policy for XmlHttpRequest to work.
                  */
-                var options = {};
-                options.onSuccess = OpenLayers.Function.bind(this.serverSet, this);
-                options.onFailure = OpenLayers.Function.bind(this.serverFailed, this);
-                var test = window.location.protocol+'//'+window.location.host;
-                //if (this.fusionURL.indexOf(test,0) == 0) {
-                if ( ((this.fusionURL.indexOf("http://") < 0) || (this.fusionURL.indexOf(test,0) == 0)) && !(this.bForceRedirect)) {
-                    this.sRedirectScript = '';
-                    options.method = 'get';
-                    this.ajaxRequest('config.json', options);
-                } else {
-                    this.sRedirectScript = 'redirect.php';
-                    this.ajaxRequest('config.json&method=get', options);
-                }
-                /*script language*/
-                this.sScriptLang =  'php';
-
-                break;
-            }
+        var test = window.location.protocol+'//'+window.location.host;
+        var configUrl = 'config.json';
+        //if (this.fusionURL.indexOf(test,0) == 0) {
+        if ( ((this.fusionURL.indexOf("http://") < 0) || (this.fusionURL.indexOf(test,0) == 0)) && !(this.bForceRedirect)) {
+            this.sRedirectScript = '';
+        } else {
+            this.sRedirectScript = 'redirect.php';
+            configUrl += '&method=get';
         }
-        if (!this.fusionURL) {
-            alert('failed to determine fusionURL.  Initailization aborted');
-            return;
+        
+        /*script language*/
+        this.sScriptLang = 'php';
+        
+        if (Fusion.configuration) {
+            //config.json loaded via single file build
+            this.serverSet();
+        } else {
+            var options = {
+                onSuccess: OpenLayers.Function.bind(this.getConfigCB, this),
+                onFailure: OpenLayers.Function.bind(this.serverFailed, this),
+                method: 'get'
+            };
+            this.ajaxRequest(configUrl, options);
         }
     },
     
@@ -359,6 +343,7 @@
         //increment the load state
         if (this.aScripts.length == 0) {
             this.setLoadState(this.loadState+1);
+            return;
         }
 
         this.aLoadingScripts = [];
@@ -492,10 +477,13 @@
             this.oBroker.setSiteURL(url, "Anonymous", "");
         }
         this.applicationDefinition = new Fusion.Lib.ApplicationDefinition(this.sessionId);
+        if (Fusion.appDefJson) {
+            Fusion.setLoadState(Fusion.LOAD_WIDGETS);
+        }
     },
     
     /**
-     * Function: serverSet
+     * Function: getConfigCB
      *
      * the server has returned the application configuration file that
      * contains enough information to bootstrap the application.
@@ -503,32 +491,10 @@
      * Parameter {Object} r 
      * an XMLHttpRequest object
      */
-    serverSet : function(r) {
+    getConfigCB : function(r) {
         if (r.responseText) {  
             eval("this.configuration="+r.responseText);
-            var s = this.configuration.mapguide.webTierUrl;
-            /* if it is set, use it ... otherwise assume fusion is installed in
-             * the default location and compute the web tier url from that
-             */
-            if (s) {
-                var nLength = s.length;
-                var slastChar =  s.charAt((nLength-1));
-                if (slastChar != '/') {
-                    s = s + "/";
-                }
-            } else {
-                var idx = this.fusionURL.lastIndexOf('fusion');
-                if (idx == -1) {
-                  s = this.fusionURL + "../";   //loaded relatively from within fusion directory
-                } else {
-                  s = this.fusionURL.substring(0, idx);
-                }
-            }
-            this.configuration.mapguide.webTierUrl = s;
-            this.configuration.mapguide.mapAgentUrl = s + 'mapagent/mapagent.fcgi?';
-            
-            //trigger loading stuff ...
-            this.setLoadState(this.LOAD_CONFIG);
+            this.serverSet();
         } else {
             //console.log('Error parsing configuration file, it is not valid somehow?');
             alert(OpenLayers.i18n('configParseError'));
@@ -536,6 +502,41 @@
     },
     
     /**
+     * Function: serverSet
+     *
+     * the server has returned the application configuration file that
+     * contains enough information to bootstrap the application.
+     *
+     * Parameter {Object} r 
+     * an XMLHttpRequest object
+     */
+    serverSet : function() {
+        var s = this.configuration.mapguide.webTierUrl;
+        /* if it is set, use it ... otherwise assume fusion is installed in
+                  * the default location and compute the web tier url from that
+                  */
+        if (s) {
+            var nLength = s.length;
+            var slastChar =  s.charAt((nLength-1));
+            if (slastChar != '/') {
+                s = s + "/";
+            }
+        } else {
+            var idx = this.fusionURL.lastIndexOf('fusion');
+            if (idx == -1) {
+              s = this.fusionURL + "../";   //loaded relatively from within fusion directory
+            } else {
+              s = this.fusionURL.substring(0, idx);
+            }
+        }
+        this.configuration.mapguide.webTierUrl = s;
+        this.configuration.mapguide.mapAgentUrl = s + 'mapagent/mapagent.fcgi?';
+        
+        //trigger loading stuff ...
+        this.setLoadState(this.LOAD_CONFIG);
+    },
+    
+    /**
      * Function: serverFailed
      *
      * the application failed to load the application configuration file.
@@ -943,7 +944,7 @@
          * Property: _scriptName
          * {String} Relative path of this script.
          */
-        _scriptName: (!singleFile) ? "lib/fusion.js" : "fusion.js",
+    _scriptName: "lib/fusion",
 
         /**
          * Function: _getScriptLocation
@@ -953,7 +954,7 @@
          * {String} Path to this script
          */
         _getScriptLocation: function () {
-            var scriptLocation = "";
+            Fusion.fusionURL = null;
             var scriptName = Fusion._scriptName;
          
             var scripts = document.getElementsByTagName('script');
@@ -961,23 +962,38 @@
                 var src = scripts[i].getAttribute('src');
                 if (src) {
                     var index = src.lastIndexOf(scriptName); 
-                    // set path length for src up to a query string
-                    var pathLength = src.lastIndexOf('?');
-                    if (pathLength < 0) {
-                        pathLength = src.length;
+                    if (index > -1) {
+                        Fusion.fusionURL = src.slice(0, index);
+                        Fusion._scriptObject = scripts[i];
+                        
+                if (Fusion.fusionURL.indexOf("http://")<0) {
+                  if (Fusion.fusionURL.slice(0,1) == "/") {
+                    Fusion.fusionURL = window.location.protocol + "//" + window.location.host + Fusion.fusionURL;
+                  } else {
+                    var newLoc = window.location.href;
+                    if (newLoc.slice(-1) != "/") {
+                      newLoc = newLoc.slice(0,newLoc.lastIndexOf("?"));
+                      newLoc = newLoc.slice(0,newLoc.lastIndexOf("/")+1);
                     }
-                    // is it found, at the end of the URL?
-                    if ((index > -1) && (index + scriptName.length == pathLength)) {
-                        scriptLocation = src.slice(0, pathLength - scriptName.length);
-                        Fusion._scriptObject = scripts[i];
+                    Fusion.fusionURL = newLoc + Fusion.fusionURL;
+                  }
+                } 
                         break;
                     }
                 }
             }
-            return scriptLocation;
-         }
+            if (!this.fusionURL) {
+                alert('failed to determine fusionURL.  Initialization aborted');
+                return;
+            }
+            return Fusion.fusionURL;
+        }
     };
 
+    /*********************************************************************************/
+    /* actual bootstrap execution code follows */
+    
+    Fusion._singleFile = singleFile;
     var host = Fusion._getScriptLocation();    
     Jx.baseURL = host + 'jx/';
     Jx.COMBINED_CSS = true;
@@ -993,7 +1009,7 @@
     }
     window._FusionLocale = locale;
     
-    if (!singleFile) {
+    if (!Fusion._singleFile) {
         if (useCompressed) {
             var coreScripts = ['lib/OpenLayers/OpenLayers.js',
                                 'jx/lib/jx_compressed.js',

Added: trunk/parseAppDef.xsl
===================================================================
--- trunk/parseAppDef.xsl	                        (rev 0)
+++ trunk/parseAppDef.xsl	2008-04-25 18:44:42 UTC (rev 1385)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+Description: Autogenerate widget documetation from widgetInfo files
+$Id$
+$Name$
+-->
+
+
+<xsl:stylesheet version="1.0" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs">
+
+  <xsl:output method="xml" omit-xml-declaration="yes"/>
+  <xsl:strip-space elements="*"/>
+  <xsl:param name="buildHome">./build</xsl:param>
+
+  <!-- Root node.  -->
+  <xsl:template match="/xxApplicationDefinition">
+    <filelist id="fusionAppWidgets" dir="{$buildHome}/widget">
+        <xsl:attribute name="files">
+          <xsl:apply-templates select="WidgetSet"/>
+        </xsl:attribute>
+    </filelist>
+  </xsl:template>
+
+  <xsl:template match="/ApplicationDefinition">
+    <xsl:variable name="widgetFileList">
+      <xsl:apply-templates select="WidgetSet"/>
+    </xsl:variable>
+    <xsl:variable name="mapFileList">
+      <xsl:apply-templates select="MapSet"/>
+    </xsl:variable>
+    <AppDef>
+      <Widgets>
+        <xsl:call-template name="removeDuplicates">
+          <xsl:with-param name="str" select="$widgetFileList"/>
+          <xsl:with-param name="sep" select="' '"/>
+        </xsl:call-template>
+      </Widgets>
+      <Maps>
+        <xsl:call-template name="removeDuplicates">
+          <xsl:with-param name="str" select="$mapFileList"/>
+          <xsl:with-param name="sep" select="' '"/>
+        </xsl:call-template>
+      </Maps>
+    </AppDef>
+  </xsl:template>
+
+  <xsl:template match="Container"/>
+  <xsl:template match="MapWidget"/>
+
+  <xsl:template match="Widget">
+    <xsl:variable name="loc">
+      <xsl:choose>
+        <xsl:when test="Location">
+          <xsl:value-of select="Location"/>
+        </xsl:when>
+        <xsl:otherwise>widgets</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:value-of select="$loc"/>/<xsl:value-of select="Type"/>.js 
+  </xsl:template>
+  <xsl:template match="MapGroup/Map"><xsl:value-of select="Type"/>/<xsl:value-of select="Type"/>.js </xsl:template>
+  
+  <xsl:template name="removeDuplicates"> <!-- tokenize a string -->
+    <xsl:param name="str"/> <!-- String to process -->
+    <xsl:param name="sep"/> <!-- Legal separator character -->
+    <xsl:param name="result"/> <!-- result to be returned -->
+    <xsl:choose>
+      <xsl:when test="contains($str,$sep)"> <!-- Only tokenize if there is a separator present in the string -->
+        <xsl:choose>
+          <xsl:when test="not(contains($result, substring-before($str,$sep)))"><!-- result doesn't already contain this token -->
+            <xsl:call-template name="removeDuplicates">  <!-- Re-tokenize the new string which is contained after the separator -->
+              <xsl:with-param name="str" select="substring-after($str,$sep)"/>
+              <xsl:with-param name="sep" select="$sep"/> 
+              <xsl:with-param name="result" select="concat($result, ' ', substring-before($str,$sep))"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>  <!-- it's a duplicate, continue without concating -->
+            <xsl:call-template name="removeDuplicates">  <!-- Re-tokenize the new string which is contained after the separator -->
+              <xsl:with-param name="str" select="substring-after($str,$sep)"/>
+              <xsl:with-param name="sep" select="$sep"/> 
+              <xsl:with-param name="result" select="$result"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>  <!-- If there is nothing else to tokenize, just return the result -->
+        <xsl:value-of select="$result"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>

Modified: trunk/text/en/strings.json
===================================================================
--- trunk/text/en/strings.json	2008-04-23 15:33:00 UTC (rev 1384)
+++ trunk/text/en/strings.json	2008-04-25 18:44:42 UTC (rev 1385)
@@ -1,4 +1,4 @@
-Fusion.Strings.en = {
+Fusion.Strings.en = {
 'scriptFailed': 'failed to load script: ${script}',
 'configParseError': 'Error parsing fusion configuration file, initialization aborted',
 'configLoadError': 'Error loading fusion configuration file, initialization aborted',



More information about the fusion-commits mailing list