view xslt/menu.xslt @ 636:310872ba13ae

Removed the "timeout=300s" directive from SMTP examples. Such an initial timeout is too long, and the default timeout of one minute is long enough. By removing it, we purposedly ignore the requirement of the current SMTP specification to set it to at least five minutes: http://tools.ietf.org/html/rfc5321#section-4.5.3.2 Submitted by Maxim Dounin.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 15 Aug 2012 11:28:37 +0000
parents 6fa99c92e40a
children ba913f7cf7c1
line wrap: on
line source

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

   <xsl:template match="menu/item">
      <xsl:choose>

         <xsl:when test="@href = $LINK">
            <xsl:choose>

               <xsl:when test="$YEAR and @href='/'">

                  <a href="./"> news </a> 
                  <br/>
               </xsl:when>

               <xsl:otherwise>

                  <xsl:value-of select=" normalize-space(text())"/>
                  <br/>
               </xsl:otherwise>
            </xsl:choose>
         </xsl:when>

         <xsl:otherwise>

            <a>

               <xsl:attribute name="href">
                  <xsl:choose>

                     <xsl:when test="starts-with(@href, $DIRNAME)">
                        <xsl:choose>

                           <xsl:when test="substring-after(@href, $DIRNAME) = ''">
                  ./</xsl:when>

                           <xsl:otherwise>

                              <xsl:value-of select=" substring-after(@href, $DIRNAME)"/>
                           </xsl:otherwise>
                        </xsl:choose>
                     </xsl:when>

                     <xsl:otherwise>

                        <xsl:value-of select=" concat($ROOT, @href)"/>
                     </xsl:otherwise>
                  </xsl:choose>
               </xsl:attribute>

               <xsl:value-of select=" normalize-space(text())"/>

            </a>

            <xsl:if test="@lang">
               <xsl:text> [</xsl:text>
               <xsl:value-of select="@lang"/>
               <xsl:text>]</xsl:text>
            </xsl:if>

            <br/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <xsl:template match="menu/item[@year]">

      <xsl:if test="$YEAR or $LINK='/'">
         <xsl:choose>

            <xsl:when test="$YEAR=@year">

               <xsl:value-of select="@year"/> 
               <br/>
            </xsl:when>

            <xsl:otherwise>

               <a href="{@href}">
                  <xsl:value-of select="@year"/>
               </a>

               <br/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:if>
   </xsl:template>

   <xsl:template match="menu/item[starts-with(@href, 'http://') or starts-with(@href, 'https://')]">

      <a href="{@href}">
         <xsl:value-of select=" normalize-space(text())"/>
      </a>

      <xsl:if test="@lang">
         <xsl:text> [</xsl:text>
         <xsl:value-of select="@lang"/>
         <xsl:text>]</xsl:text>
      </xsl:if>

      <br/>
   </xsl:template>

   <xsl:template match="menu/item[not(@href)]">

      <xsl:value-of select=" normalize-space(text())"/> 
      <br/>
   </xsl:template>

</xsl:stylesheet>