Ignore:
Timestamp:
2009-02-09T17:49:07+13:00 (15 years ago)
Author:
max
Message:

Simplified the site home transformation, library.xsl defines the output method and allow the user to create its own gslib elements, addind util.xsl containing all the gslib elements provided by us.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/web/interfaces/default/transform/home.xsl

    r18388 r18482  
    11<?xml version="1.0" encoding="ISO-8859-1"?>
    22<xsl:stylesheet version="1.0"
    3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    4   xmlns:java="http://xml.apache.org/xslt/java"
    5   xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
    6   extension-element-prefixes="java util"
    7   exclude-result-prefixes="java util">
     3    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     4    xmlns:java="http://xml.apache.org/xslt/java"
     5    xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
     6    xmlns:gslib="http://www.greenstone.org/skinning"
     7    extension-element-prefixes="java util"
     8    exclude-result-prefixes="util java util">
    89
    9   <!-- style includes global params interface_name, library_name -->
    10   <xsl:include href="style.xsl"/>
     10 
     11  <xsl:template match="page/pageResponse">
     12 
     13   <!-- the main page layout template is here -->
     14    <html>
     15           
     16          <head>
     17            <title>
     18                <gslib:homePageTitle/>
     19            </title>
     20            <link rel="stylesheet" href="interfaces/default/style/core.css" type="text/css"/>
     21          </head>
     22         
     23          <body><gslib:textDirectionAttribute/>
     24       
     25        <div id="page-wrapper">
     26        <gslib:displayErrorsIfAny/>
     27     
     28       
     29        <div id="banner">
     30          <p>
     31            <img src="interfaces/default/images/gsdlhead.gif"><xsl:attribute name="alt"><gslib:greenstoneLogoAlternateText/></xsl:attribute>
     32            </img>
     33          </p>
     34        </div>
     35       
     36        <div id="content">
     37       
     38            <div class="divbar"><gslib:selectACollectionTextBar/></div>
     39           
     40            <div class="QuickSearch">
     41                <gslib:crossCollectionQuickSearchForm/>
     42            </div>
     43               
     44           
     45            <ul id="collectionlist">
     46                <xsl:for-each select="collectionList/collection">
     47                    <li>
     48                        <gslib:collectionLinkWithImage/>
     49                    </li>
     50                </xsl:for-each>
     51            </ul>
     52           
     53            <gslib:serviceClusterList/>
     54           
     55            <div class="divbar"><gslib:noTextBar/></div>
     56           
     57            <ul id="servicelist">
     58                <xsl:for-each select="serviceList/service[@type='query']">
     59                    <li><gslib:serviceLink/></li>
     60                </xsl:for-each>
     61               
     62             <!--uncomment the line below to display an authentication link inside a <li>-->
     63             <!--<gslib:authenticationLink/>-->
     64               
     65             <!--uncomment the line below to display a library interface link inside a <li>-->
     66             <!--<gslib:libraryInterfaceLink/>-->
     67            </ul>
     68           
     69        </div>
    1170
    12   <xsl:output method="html"/> 
    13  
    14   <!-- the main page layout template is here -->
    15   <xsl:template match="page">
    16     <html>
    17       <head>
    18     <title>
    19       <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
    20       <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
    21     </title>
    22     <xsl:call-template name="globalStyle"/>
    23     <xsl:call-template name="pageStyle"/>
    24       </head>
    25       <body>
    26     <xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
    27     <div id="page-wrapper">
    28       <xsl:call-template name="response" />
    29       <xsl:call-template name="greenstoneFooter"/>
    30     </div>
    31       </body>
     71       
     72            <div id="footer">
     73                <div class="divbar"><gslib:poweredByGS3TextBar/></div>
     74            </div>
     75         
     76        </div>
     77       
     78       </body>
    3279    </html>
    33   </xsl:template>
    34 
    35   <xsl:template name="pageTitle">
    36     <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
    37   </xsl:template>
    38 
    39   <!-- page specific style goes here -->
    40   <xsl:template name="pageStyle"/>
    41 
    42   <xsl:template match="pageResponse">
    43     <xsl:call-template name="pageBanner"/>
    44     <xsl:apply-templates select="serviceList/service[@name='TextQuery']"/>
    45     <xsl:apply-templates select="collectionList"/>   
    46     <xsl:apply-templates select="serviceClusterList"/>
    47     <xsl:apply-templates select="serviceList"/>
    48   </xsl:template>
    49 
    50   <xsl:template name="pageBanner">
    51     <div id="banner">
    52       <p>
    53     <img src="interfaces/default/images/gsdlhead.gif"><xsl:attribute name="alt"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/></xsl:attribute>
    54     </img>
    55       </p>
    56     </div>
    57     <div id="content">
    58       <xsl:call-template name="dividerBar">
    59     <xsl:with-param name="text" select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/>
    60       </xsl:call-template> 
    61     </div>
    62   </xsl:template>
    63 
    64   <xsl:template match="collectionList">
    65     <ul id="collectionlist">
    66       <xsl:for-each select="collection">
    67     <li>
    68      
    69       <xsl:choose>
    70         <xsl:when test="displayItem[@name='icon']">
    71               <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
    72                 <img>
    73           <xsl:attribute name="src">
    74             <xsl:value-of select="metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="displayItem[@name='icon']"/>
    75           </xsl:attribute>
    76           <xsl:attribute name="alt">
    77             <xsl:value-of select="displayItem[@name='name']"/>
    78           </xsl:attribute>
    79         </img>
    80           </a> 
    81         </xsl:when>
    82         <xsl:otherwise>
    83           <a class="noimage" href="{$library_name}?a=p&amp;sa=about&amp;c={@name}"> 
    84         <xsl:value-of select="displayItem[@name='name']"/>
    85           </a>
    86         </xsl:otherwise>
    87       </xsl:choose>         
    88      
    89     </li>
    90       </xsl:for-each>
    91     </ul>
    92   </xsl:template>
    93  
    94   <xsl:template match="serviceClusterList">
    95     <xsl:for-each select="serviceCluster">
    96       <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}"><xsl:value-of select='@name'/><xsl:value-of select="displayItem[@name='name']"/></a>
    97     </xsl:for-each>
    98   </xsl:template>
    99 
    100   <xsl:template match="service[@name='TextQuery']">
    101     <div class="QuickSearch">
    102       <form name="QuickSearch" method="get" action="{$library_name}">
    103     <input type="hidden" name="a" value="q"/>
    104     <input type="hidden" name="rt" value="rd"/>
    105     <input type="hidden" name="s" value="{@name}"/>
    106     <input type="hidden" name="s1.collection" value="all"/>
    107     <input type="text" name="s1.query" size="20"/>
    108     <input type="submit"><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/></xsl:attribute></input>
    109       </form>
    110     </div>
    111   </xsl:template>
    112 
    113   <xsl:template match="serviceList">
    114     <xsl:call-template name="dividerBar"/>
    115     <ul id="servicelist">
    116       <xsl:for-each select="service[@type='query']">
    117     <li><a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}"><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li>
    118       </xsl:for-each>
    119       <!--uncomment to display an authentication link-->
    120       <!--<xsl:for-each select="service[@type='authen']">
    121       <li><a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s={@name}&amp;s1.aup=Login&amp;s1.un=&amp;s1.asn="><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li>      </xsl:for-each>-->
    122       <!--uncomment to display a library interface link-->
    123       <!--<li><a href="{$library_name}?a=p&amp;sa=gli4gs3"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/></a></li>-->
    124     </ul>
     80   
     81   
    12582  </xsl:template>
    12683</xsl:stylesheet> 
Note: See TracChangeset for help on using the changeset viewer.