You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by je...@apache.org on 2003/06/04 00:31:10 UTC

cvs commit: xml-forrest/src/resources/skins/common/xslt/html tab2menu.xsl tabutils.xsl

jefft       2003/06/03 15:31:10

  Modified:    src/resources/skins/common/xslt/html tab2menu.xsl
                        tabutils.xsl
  Log:
  Add site.xml @tab tab selection algorithm, activated if tabs.xml entries have
  an @id attribute
  
  Revision  Changes    Path
  1.7       +12 -2     xml-forrest/src/resources/skins/common/xslt/html/tab2menu.xsl
  
  Index: tab2menu.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/common/xslt/html/tab2menu.xsl,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- tab2menu.xsl	2 Apr 2003 11:01:32 -0000	1.6
  +++ tab2menu.xsl	3 Jun 2003 22:31:10 -0000	1.7
  @@ -97,6 +97,13 @@
       </xsl:call-template>
     </xsl:variable>
   
  +  <xsl:variable name="matching-id">
  +    <xsl:call-template name="matching-id">
  +      <xsl:with-param name="tabfile" select="/"/>
  +    </xsl:call-template>
  +  </xsl:variable>
  +
  +
     <!-- Called from tabs, after it has written the outer 'div class=tabs' and
     any other HTML -->
     <xsl:template name="base-tabs">
  @@ -111,7 +118,10 @@
   
     <xsl:template match="tab">
       <xsl:choose>
  -      <xsl:when test="@dir = $longest-dir or @href = $longest-dir">
  +      <xsl:when test="@id and @id = $matching-id">
  +        <xsl:call-template name="selected"/>
  +	  </xsl:when>
  +      <xsl:when test="not(@id) and @dir = $longest-dir or @href = $longest-dir">
           <xsl:call-template name="selected"/>
         </xsl:when>
         <xsl:otherwise>
  
  
  
  1.4       +11 -1     xml-forrest/src/resources/skins/common/xslt/html/tabutils.xsl
  
  Index: tabutils.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/common/xslt/html/tabutils.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- tabutils.xsl	9 May 2003 03:16:43 -0000	1.3
  +++ tabutils.xsl	3 Jun 2003 22:31:10 -0000	1.4
  @@ -7,6 +7,9 @@
   
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   
  +  <xsl:param name="site-file" select="'cocoon://abs-linkmap'"/>
  +  <xsl:variable name="site" select="document($site-file)"/>
  + 
     <!-- Given the current path and a tabs.xml entry, returns a relative path to
     the specified tab's URL.  When rendering a set of tabs, this template will be
     called once per tab.
  @@ -47,7 +50,14 @@
       </xsl:if>
     </xsl:template>
   
  -
  +  <!--
  +    The id of any tab, whose path is a subset of the current URL.  Ie,
  +    the path of the 'current' tab.
  +  -->
  +  <xsl:template name="matching-id" xmlns:l="http://apache.org/forrest/linkmap/1.0">
  +    <xsl:value-of select="$site//*[starts-with(@href, $path)]/@tab"/>
  +  </xsl:template>
  + 
     <!--
       The longest path of any tab, whose path is a subset of the current URL.  Ie,
       the path of the 'current' tab.