Changeset 24469


Ignore:
Timestamp:
08/25/11 11:07:43 (9 years ago)
Author:
sjm84
Message:

Refactored the set up of the gs variable to use less script tags

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/oran/transform/javascript-global-setup.xsl

    r24468 r24469  
    2323   
    2424    <xsl:template name="populate-cgi-param-values">
    25         <xsl:for-each select="/page/pageRequest/paramList/param">
    26             <script type="text/javascript">
    27                 <xsl:text disable-output-escaping="yes">var name = "</xsl:text><xsl:value-of select="@name"/><xsl:text disable-output-escaping="yes">";</xsl:text>
    28                 <xsl:text disable-output-escaping="yes">var value = "</xsl:text><xsl:value-of select="@value"/><xsl:text disable-output-escaping="yes">";</xsl:text>
     25        <script type="text/javascript">
     26            var name;
     27            var value;
     28            <xsl:for-each select="/page/pageRequest/paramList/param">
     29                <xsl:text disable-output-escaping="yes">name = "</xsl:text><xsl:value-of select="@name"/><xsl:text disable-output-escaping="yes">";</xsl:text>
     30                <xsl:text disable-output-escaping="yes">value = "</xsl:text><xsl:value-of select="@value"/><xsl:text disable-output-escaping="yes">";</xsl:text>
    2931                <xsl:text disable-output-escaping="yes">name = name.replace(".", "_");</xsl:text>
    3032                gs.cgiParams[name] = value;
    31             </script>
    32         </xsl:for-each>
     33            </xsl:for-each>
     34        </script>
    3335    </xsl:template>
    3436   
     
    5355                    }
    5456                }
     57                var name;
     58                var value;
     59                var lang;
    5560            </xsl:text>
     61            <xsl:for-each select="/page/pageResponse/metadataList/metadata">
     62                <xsl:text disable-output-escaping="yes">name = "</xsl:text><xsl:value-of select="@name"/><xsl:text disable-output-escaping="yes">";</xsl:text>
     63                <xsl:text disable-output-escaping="yes">value = "</xsl:text><xsl:value-of disable-output-escaping="yes" select="."/><xsl:text disable-output-escaping="yes">";</xsl:text>
     64                <xsl:text disable-output-escaping="yes">lang = "</xsl:text><xsl:value-of select="@lang"/><xsl:text disable-output-escaping="yes">";</xsl:text>
     65                addMetadataToList(name, value, gs.siteMetadata, lang);
     66            </xsl:for-each>
     67       
     68            <xsl:for-each select="/page/pageResponse/collection/metadataList/metadata">
     69                <xsl:text disable-output-escaping="yes">name = "</xsl:text><xsl:value-of select="@name"/><xsl:text disable-output-escaping="yes">";</xsl:text>
     70                <xsl:text disable-output-escaping="yes">value = "</xsl:text><xsl:value-of disable-output-escaping="yes" select="."/><xsl:text disable-output-escaping="yes">";</xsl:text>
     71                <xsl:text disable-output-escaping="yes">lang = "</xsl:text><xsl:value-of select="@lang"/><xsl:text disable-output-escaping="yes">";</xsl:text>
     72                addMetadataToList(name, value, gs.collectionMetadata, lang);
     73            </xsl:for-each>
     74       
     75            <xsl:for-each select="/page/pageResponse/document/metadataList/metadata">
     76                <xsl:text disable-output-escaping="yes">name = "</xsl:text><xsl:value-of select="@name"/><xsl:text disable-output-escaping="yes">";</xsl:text>
     77                <xsl:text disable-output-escaping="yes">value = "</xsl:text><xsl:value-of disable-output-escaping="yes" select="."/><xsl:text disable-output-escaping="yes">";</xsl:text>
     78                <xsl:text disable-output-escaping="yes">lang = "</xsl:text><xsl:value-of select="@lang"/><xsl:text disable-output-escaping="yes">";</xsl:text>
     79                addMetadataToList(name, value, gs.documentMetadata, lang);
     80            </xsl:for-each>
    5681        </script>
    57         <xsl:for-each select="/page/pageResponse/metadataList/metadata">
    58             <script type="text/javascript">
    59                 <xsl:text disable-output-escaping="yes">var name = "</xsl:text><xsl:value-of select="@name"/><xsl:text disable-output-escaping="yes">";</xsl:text>
    60                 <xsl:text disable-output-escaping="yes">var value = "</xsl:text><xsl:value-of disable-output-escaping="yes" select="."/><xsl:text disable-output-escaping="yes">";</xsl:text>
    61                 <xsl:text disable-output-escaping="yes">var lang = "</xsl:text><xsl:value-of select="@lang"/><xsl:text disable-output-escaping="yes">";</xsl:text>
    62                 addMetadataToList(name, value, gs.siteMetadata, lang);
    63             </script>
    64         </xsl:for-each>
    65        
    66         <xsl:for-each select="/page/pageResponse/collection/metadataList/metadata">
    67             <script type="text/javascript">
    68                 <xsl:text disable-output-escaping="yes">var name = "</xsl:text><xsl:value-of select="@name"/><xsl:text disable-output-escaping="yes">";</xsl:text>
    69                 <xsl:text disable-output-escaping="yes">var value = "</xsl:text><xsl:value-of disable-output-escaping="yes" select="."/><xsl:text disable-output-escaping="yes">";</xsl:text>
    70                 <xsl:text disable-output-escaping="yes">var lang = "</xsl:text><xsl:value-of select="@lang"/><xsl:text disable-output-escaping="yes">";</xsl:text>
    71                 addMetadataToList(name, value, gs.collectionMetadata, lang);
    72             </script>
    73         </xsl:for-each>
    74        
    75         <xsl:for-each select="/page/pageResponse/document/metadataList/metadata">
    76             <script type="text/javascript">
    77                 <xsl:text disable-output-escaping="yes">var name = "</xsl:text><xsl:value-of select="@name"/><xsl:text disable-output-escaping="yes">";</xsl:text>
    78                 <xsl:text disable-output-escaping="yes">var value = "</xsl:text><xsl:value-of disable-output-escaping="yes" select="."/><xsl:text disable-output-escaping="yes">";</xsl:text>
    79                 <xsl:text disable-output-escaping="yes">var lang = "</xsl:text><xsl:value-of select="@lang"/><xsl:text disable-output-escaping="yes">";</xsl:text>
    80                 addMetadataToList(name, value, gs.documentMetadata, lang);
    81             </script>
    82         </xsl:for-each>
    8382    </xsl:template>
    8483   
Note: See TracChangeset for help on using the changeset viewer.