forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From je...@apache.org
Subject cvs commit: xml-forrest/src/resources/skins/forrest-site/xslt/html pathutils.xsl book2menu.xsl document2html.xsl site2xhtml.xsl tab2menu.xsl
Date Sat, 02 Nov 2002 10:09:40 GMT
jefft       2002/11/02 02:09:39

  Modified:    .        status.xml
               src/documentation/content/xdocs tabs.xml
               src/resources/conf sitemap.xmap
               src/resources/schema/dtd tab-cocoon-v10.dtd
               src/resources/skins/basic/xslt/html book2menu.xsl
                        tab2menu.xsl
               src/resources/skins/forrest-site/xslt/html book2menu.xsl
                        document2html.xsl site2xhtml.xsl tab2menu.xsl
  Added:       src/resources/skins/forrest-site/xslt/html pathutils.xsl
  Log:
  - Fix up tabs:
    - Fix bug where we couldn't have a tab link without also a book.xml link
    - tabs.xml entries can now take a @href link to any URL, not just
      directories. @dir is still allowed for backwards-compat.
    - Improved algorithm for determining which tab is on.
    - Tab links to directories now have '/index.html' appended, to avoid CLI bug,
      and prevent dir listings when viewing generated sites via file: protocol.
  - Document the various forrest-site XSLTs
  - Simplify contract between sitemap and skin stylesheets. Rather than
    'resource' and 'dir', have a single 'path'.
  - Add 'nopdf' skin parameter, indicating that a PDF is inappropriate for this
    page.
  - As a result of all this, Forrest's site has broken links :) Let's try to keep
    it this way.
  
  Revision  Changes    Path
  1.26      +21 -4     xml-forrest/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/xml-forrest/status.xml,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- status.xml	1 Nov 2002 03:33:02 -0000	1.25
  +++ status.xml	2 Nov 2002 10:09:39 -0000	1.26
  @@ -64,10 +64,6 @@
        <link href="libre-intro.html">Libre</link>
        facility - replacement for */book.xml
       </action>
  -    <action context="docs" dev="open">
  -     There are some broken PDF documents after build, resulting in
  -     "broken link" messages. Not sure why.
  -    </action>
       <action context="code" dev="open">
        Images (&lt;figure&gt;) are not yet handled by the PDF generation.
        see <code>skins/forrest-site/xslt/fo/document2fo.xsl</code> and email
  @@ -107,6 +103,27 @@
   
     <changes>
      <release version="0.1" date="2002">
  +    <action dev="JT" type="add" context="skins">
  +     Enhanced forrest-site skin's tabs.  Any URL (not just directories) can now
  +     be tabbed with a new 'href' attribute. There is an improved 'longest match'
  +     algorithm for deciding which tab is on which is more robust than the old
  +     one.
  +    </action>
  +    <action dev="JT" type="fix" context="skins">
  +     Fixed a bug where having a tabs.xml link to a file not otherwise mentioned
  +     in book.xml caused a broken link.  See
  +     <link
  +      href="http://marc.theaimsgroup.com/?t=103607092100004&amp;r=1&amp;w=2">forrest-dev
  +      discussion</link>
  +    </action>
  +    <action dev="JT" type="fix" context="docs">
  +     Fixed all broken links in the Forrest site.
  +    </action>
  +    <action dev="JT" type="fix" context="docs">
  +     Simplified the sitemap-stylesheet contract.  Instead of 'dir' and
  +     'resource' parameters with varying meaning, there is just one 'path'
  +     parameter.
  +    </action>
       <action dev="JT" type="add" context="docs">
        Allow user to specify what XML files to validate via
        <code>forrest.validate.{includes,excludes}</code> properties.
  
  
  
  1.6       +9 -2      xml-forrest/src/documentation/content/xdocs/tabs.xml
  
  Index: tabs.xml
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/documentation/content/xdocs/tabs.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- tabs.xml	26 Oct 2002 12:09:41 -0000	1.5
  +++ tabs.xml	2 Nov 2002 10:09:39 -0000	1.6
  @@ -6,7 +6,14 @@
       copyright="@year@ The Apache Foundation"
       xmlns:xlink="http://www.w3.org/1999/xlink">
   
  -  <tab label="Home" dir=""/>
  -  <tab label="How-Tos" dir="community/howto"/>
  +    <!-- The rules are:
  +    @dir will always have /index.html added.
  +    @href is not modified unless it is root-relative and obviously specifies a
  +    directory (ends in '/'), in which case /index.html will be added
  +    -->
  +
  +    <tab label="Home" dir=""/>
  +    <tab label="How-Tos" dir="community/howto"/>
  +    <tab label="YourProj" href="your-project.html"/>
   
   </tabs>
  
  
  
  1.28      +23 -35    xml-forrest/src/resources/conf/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/conf/sitemap.xmap,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- sitemap.xmap	1 Nov 2002 09:44:32 -0000	1.27
  +++ sitemap.xmap	2 Nov 2002 10:09:39 -0000	1.28
  @@ -113,8 +113,8 @@
     <map:resource name="skinit">
      <map:transform src="skins/{defaults:skin}/xslt/html/{type}.xsl">
        <map:parameter name="isfaq" value="{isfaq}"/>
  -     <map:parameter name="dir" value="{dir}"/>
  -     <map:parameter name="resource" value="{resource}"/>
  +     <map:parameter name="nopdf" value="{nopdf}"/>
  +     <map:parameter name="path" value="{path}"/>
        <!-- Can set an alternative project skinconfig here 
        <map:parameter name="config-file" value="../../../../skinconf.xml"/>
        -->
  @@ -126,7 +126,7 @@
       <map:generate src="content/xdocs/{../1}book.xml"/>
       <map:call resource="skinit">
         <map:parameter name="type" value="book2menu"/>
  -      <map:parameter name="resource" value="{resource}.html"/>
  +      <map:parameter name="path" value="{path}"/>
       </map:call>
     </map:resource>
   
  @@ -159,20 +159,19 @@
       <map:generate src="content/xdocs/tabs.xml"/>
       <map:call resource="skinit">
        <map:parameter name="type" value="tab2menu"/>
  -     <map:parameter name="resource" value="{1}"/>
  -     <map:parameter name="dir" value="{1}/"/>
  +     <map:parameter name="path" value="{2}.html"/>
       </map:call>
     </map:match>
   
     <map:match pattern="**book-**/*.xml">
       <map:call resource="book">
  -      <map:parameter name="resource" value="{3}"/>
  +     <map:parameter name="path" value="{2}/{3}"/>
       </map:call>
     </map:match>
   
     <map:match pattern="**book-**.xml">
       <map:call resource="book">
  -      <map:parameter name="resource" value="{2}"/>
  +      <map:parameter name="path" value="{2}"/>
       </map:call>
     </map:match>
   
  @@ -181,8 +180,7 @@
        <map:transform src="library/xslt/todo2document.xsl" label="content"/>
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
  -      <map:parameter name="resource" value="todo"/>
  -      <map:parameter name="dir" value=""/>
  +      <map:parameter name="path" value="/todo.xml"/>
        </map:call>
      </map:match>
   
  @@ -191,8 +189,7 @@
        <map:transform src="library/xslt/changes2document.xsl" label="content"/>
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
  -      <map:parameter name="resource" value="changes"/>
  -      <map:parameter name="dir" value=""/>
  +      <map:parameter name="path" value="/changes"/>
        </map:call>
      </map:match>
   
  @@ -201,8 +198,7 @@
        <map:transform src="library/xslt/faq2document.xsl" label="content"/>
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
  -      <map:parameter name="resource" value="faq"/>
  -      <map:parameter name="dir" value=""/>
  +      <map:parameter name="path" value="{1}/faq"/>
         <map:parameter name="isfaq" value="true"/>
   
        </map:call>
  @@ -213,8 +209,7 @@
        <map:transform src="library/xslt/faq2document.xsl" label="content"/>
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
  -      <map:parameter name="resource" value="faq"/>
  -      <map:parameter name="dir" value=""/>
  +      <map:parameter name="path" value="faq"/>
         <map:parameter name="isfaq" value="true"/>
   
        </map:call>
  @@ -231,8 +226,7 @@
        <map:generate src="content/xdocs/community/{1}/index.xml"/>
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
  -      <map:parameter name="dir" value="community/{1}/"/>
  -      <map:parameter name="resource" value="index"/>
  +      <map:parameter name="path" value="community/{1}/index"/>
        </map:call>
      </map:match>
   
  @@ -241,8 +235,7 @@
        <map:generate src="content/xdocs/community{1}revision-{2}.xml"/>
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
  -      <map:parameter name="resource" value="{1}"/>
  -      <map:parameter name="dir" value="community/{1}/"/>
  +      <map:parameter name="path" value="community/{1}/revision-{2}"/>
        </map:call>
      </map:match>
   
  @@ -255,8 +248,7 @@
        <map:transform src="library/xslt/{1}2document.xsl" label="content"/>
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
  -      <map:parameter name="resource" value="{3}"/>
  -      <map:parameter name="dir" value="community/{1}/{2}/"/>
  +      <map:parameter name="path" value="community/{1}/{2}/{3}"/>
        </map:call>
      </map:match>
   
  @@ -278,8 +270,7 @@
      <map:transform src="library/xslt/howto2document.xsl" label="content"/>
      <map:call resource="skinit">
        <map:parameter name="type" value="document2html"/>
  -     <map:parameter name="resource" value="{3}"/>
  -     <map:parameter name="dir" value="{1}howto/"/>
  +     <map:parameter name="path" value="{1}howto/{2}"/>
      </map:call>
    </map:match>
   
  @@ -295,7 +286,8 @@
          <map:parameter name="uri" value="{1}"/>
        </map:transform>
        <map:serialize type="xml"/>
  -   </map:match>
  +    </map:match>
  +
      <map:match pattern="body-doclist.xml">
        <map:aggregate element="doclist">
          <map:part src="cocoon:/doclist/content/xdocs/book.xml"/>
  @@ -304,7 +296,8 @@
        <map:transform src="library/xslt/doclist2document.xsl"/>
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
  -      <map:parameter name="dir" value="community/{1}/{2}/"/>
  +      <map:parameter name="path" value="doclist"/>
  +      <map:parameter name="nopdf" value="true"/>
        </map:call>
      </map:match>
   
  @@ -319,8 +312,7 @@
        <map:call resource="skinit">
         <map:parameter name="type" value="document2html"/>
         <map:parameter name="isfaq" value="true"/>
  -      <map:parameter name="resource" value="{1}.dtdx"/>
  -      <map:parameter name="dir" value="{1}"/>
  +      <map:parameter name="path" value="{1}.dtdx.html"/>
        </map:call>
      </map:match>
   
  @@ -329,8 +321,7 @@
       <map:generate src="content/xdocs/{1}/{2}.xml"/>
       <map:call resource="skinit">
        <map:parameter name="type" value="document2html"/>
  -     <map:parameter name="dir" value="{1}/"/>
  -     <map:parameter name="resource" value="{2}"/>
  +     <map:parameter name="path" value="{1}/{2}"/>
       </map:call>
       </map:match>
   
  @@ -339,8 +330,7 @@
       <map:generate src="content/xdocs/{1}.xml"/>
       <map:call resource="skinit">
        <map:parameter name="type" value="document2html"/>
  -     <map:parameter name="dir" value="/"/>
  -     <map:parameter name="resource" value="{1}"/>
  +     <map:parameter name="path" value="{1}"/>
       </map:call>
      </map:match>
   
  @@ -352,8 +342,7 @@
       </map:aggregate>
       <map:call resource="skinit">
         <map:parameter name="type" value="site2xhtml"/>
  -      <map:parameter name="dir" value=""/>
  -      <map:parameter name="resource" value="{0}"/>
  +      <map:parameter name="path" value="{1}"/>
       </map:call>
      </map:match>
   
  @@ -365,8 +354,7 @@
       </map:aggregate>
        <map:call resource="skinit">
         <map:parameter name="type" value="site2xhtml"/>
  -      <map:parameter name="dir" value="{1}/"/>
  -      <map:parameter name="resource" value="{0}"/>
  +      <map:parameter name="path" value="{1}/{2}"/>
        </map:call>
      </map:match>
   
  
  
  
  1.5       +6 -2      xml-forrest/src/resources/schema/dtd/tab-cocoon-v10.dtd
  
  Index: tab-cocoon-v10.dtd
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/schema/dtd/tab-cocoon-v10.dtd,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- tab-cocoon-v10.dtd	11 Oct 2002 07:22:35 -0000	1.4
  +++ tab-cocoon-v10.dtd	2 Nov 2002 10:09:39 -0000	1.5
  @@ -3,7 +3,8 @@
        Apache Cocoon Documentation Tab DTD (Version 1.0)
   
   PURPOSE:
  -This DTD defines the */tab.xml documentation configuration files.
  +This DTD defines the */tab.xml documentation configuration files.  Tabs are
  +visual indicators that a certain subsection of the URI space is being browsed.
   
   TYPICAL INVOCATION:
   
  @@ -21,11 +22,13 @@
     
   AUTHORS:
     Bert Van Kets <bert@vankets.com>
  +  Jeff Turner <jefft@apache.org>
     
   FIXME:
     - find the proper DTD for top.xml
   
   CHANGE HISTORY:
  +  20021102 Revised to allow either @dir or @href (JT)
     20020506 Initial version. (BVK)
       
   COPYRIGHT:
  @@ -47,7 +50,8 @@
   >
   <!ATTLIST tab
     label CDATA #REQUIRED
  -  dir CDATA #REQUIRED
  +  dir CDATA #IMPLIED
  +  href CDATA #IMPLIED
     type (visible | hidden) "visible"
   >
   <!-- =============================================================== -->
  
  
  
  1.3       +10 -5     xml-forrest/src/resources/skins/basic/xslt/html/book2menu.xsl
  
  Index: book2menu.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/basic/xslt/html/book2menu.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- book2menu.xsl	18 Jun 2002 12:47:18 -0000	1.2
  +++ book2menu.xsl	2 Nov 2002 10:09:39 -0000	1.3
  @@ -1,10 +1,15 @@
   <?xml version="1.0"?>
   
  -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  -                version="1.0">
  -
  -  <xsl:param name="resource"/>
  +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  +  <xsl:param name="path"/>
   
  +  <xsl:include href="pathutils.xsl"/>
  +  <xsl:variable name="filename">
  +    <xsl:call-template name="filename">
  +      <xsl:with-param name="path" select="$path"/>
  +    </xsl:call-template>
  +  </xsl:variable>
  + 
     <xsl:template match="book">
       <menu>
         <xsl:apply-templates/>
  @@ -25,7 +30,7 @@
     <xsl:template match="menu-item">-&#160;
       <xsl:if test="not(@type) or @type!='hidden'">
          <xsl:choose>
  -         <xsl:when test="starts-with(@href, $resource)">
  +         <xsl:when test="starts-with(@href, $filename)">
             <xsl:value-of select="@label"/>
            </xsl:when>
            <xsl:otherwise>
  
  
  
  1.4       +11 -4     xml-forrest/src/resources/skins/basic/xslt/html/tab2menu.xsl
  
  Index: tab2menu.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/basic/xslt/html/tab2menu.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- tab2menu.xsl	10 Sep 2002 08:04:50 -0000	1.3
  +++ tab2menu.xsl	2 Nov 2002 10:09:39 -0000	1.4
  @@ -1,7 +1,14 @@
   <?xml version="1.0"?>
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  -  <xsl:param name="resource"/>
  +  <xsl:param name="path"/>
     <xsl:include href="dotdots.xsl"/>
  +  <xsl:include href="pathutils.xsl"/>
  +
  +  <xsl:variable name="filename">
  +    <xsl:call-template name="filename">
  +      <xsl:with-param name="path" select="$path"/>
  +    </xsl:call-template>
  +  </xsl:variable>
     
     <xsl:template name="spacer">
       <td> | </td>
  @@ -12,7 +19,7 @@
            <a>
              <xsl:attribute name="href">
                <xsl:call-template name="dotdots">
  -               <xsl:with-param name="path" select="$resource"/>
  +               <xsl:with-param name="path" select="$filename"/>
                </xsl:call-template>
                <xsl:if test="@dir != ''">
                  <xsl:value-of select="concat(translate(normalize-space(translate(@dir,
' /', '/ ')), ' /', '/ '), '/')"/>
  @@ -39,12 +46,12 @@
     <xsl:template match="tab">
       <xsl:call-template name="spacer"/>
       <xsl:choose>
  -      <xsl:when test="$resource!='' and @dir=''">
  +      <xsl:when test="$filename!='' and @dir=''">
           <xsl:call-template name="not-selected"/>
         </xsl:when>
         <xsl:otherwise>
           <xsl:choose>
  -          <xsl:when test="starts-with($resource,@dir)">
  +          <xsl:when test="starts-with($filename,@dir)">
              <xsl:call-template name="selected"/>
             </xsl:when>
             <xsl:otherwise>
  
  
  
  1.5       +21 -3     xml-forrest/src/resources/skins/forrest-site/xslt/html/book2menu.xsl
  
  Index: book2menu.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/forrest-site/xslt/html/book2menu.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- book2menu.xsl	23 Sep 2002 07:47:41 -0000	1.4
  +++ book2menu.xsl	2 Nov 2002 10:09:39 -0000	1.5
  @@ -1,6 +1,24 @@
   <?xml version="1.0"?>
  +<!--
  +book2menu.xsl generates the HTML menu. It outputs XML/HTML of the form:
  +  <div class="menu">
  +     ...
  +  </div>
  +which is then merged with other HTML by site2xhtml.xsl
  +
  +$Id$
  +-->
  +
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  -  <xsl:param name="resource"/> <!-- filename, eg 'index.html' -->
  +  <xsl:param name="path"/>
  +
  +  <xsl:include href="pathutils.xsl"/>
  +  <xsl:variable name="filename">
  +    <xsl:call-template name="filename">
  +      <xsl:with-param name="path" select="$path"/>
  +    </xsl:call-template>
  +  </xsl:variable>
  + 
     <xsl:template match="book">
       <div class="menu">
         <ul>
  @@ -19,7 +37,7 @@
     <xsl:template match="menu-item">
       <li>
          <xsl:choose>
  -         <xsl:when test="starts-with(@href, $resource)">
  +         <xsl:when test="starts-with(@href, $filename)">
             <span class="sel"><font color="#ffcc00"><xsl:value-of select="@label"/></font></span>
           </xsl:when>
           <xsl:otherwise>
  @@ -31,7 +49,7 @@
     <xsl:template match="external">
       <li>
          <xsl:choose>
  -         <xsl:when test="starts-with(@href, $resource)">
  +         <xsl:when test="starts-with(@href, $filename)">
             <font color="#ffcc00"><xsl:value-of select="@label"/></font>
           </xsl:when>
           <xsl:otherwise>
  
  
  
  1.11      +40 -9     xml-forrest/src/resources/skins/forrest-site/xslt/html/document2html.xsl
  
  Index: document2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/forrest-site/xslt/html/document2html.xsl,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- document2html.xsl	12 Oct 2002 12:50:25 -0000	1.10
  +++ document2html.xsl	2 Nov 2002 10:09:39 -0000	1.11
  @@ -1,22 +1,51 @@
   <?xml version="1.0"?>
  -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  +<!--
  +This stylesheet contains the majority of templates for converting documentv11
  +to HTML.  It renders XML as HTML in this form:
  +
  +  <div class="content">
  +   ...
  +  </div>
  +
  +..which site2xhtml.xsl then combines with HTML from the index (book2menu.xsl)
  +and tabs (tab2menu.xsl) to generate the final HTML.
   
  -  <xsl:include href = "split.xsl"/>
  +$Id$
  +-->
  +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   
  +  <!-- If non-blank, a PDF link for this page will not be generated -->
  +  <xsl:param name="nopdf"/>
     <xsl:param name="isfaq"/>
  -  <xsl:param name="resource"/> <!-- Filename part, eg 'index' from index.html'
-->
  -  <xsl:param name="dir"/>
  +  <xsl:param name="path"/>
  +
  +  <xsl:include href="split.xsl"/>
     <xsl:include href="dotdots.xsl"/>
  +  <xsl:include href="pathutils.xsl"/>
   
  +  <!-- Path to site root, eg '../../' -->
     <xsl:variable name="root">
       <xsl:call-template name="dotdots">
  -      <xsl:with-param name="path" select="$dir"/>
  +      <xsl:with-param name="path" select="$path"/>
  +    </xsl:call-template>
  +  </xsl:variable>
  +
  +  <xsl:variable name="filename-noext">
  +    <xsl:call-template name="filename-noext">
  +      <xsl:with-param name="path" select="$path"/>
       </xsl:call-template>
     </xsl:variable>
    
     <xsl:variable name="skin-img-dir" select="concat(string($root), 'skin/images')"/>
   
     <xsl:template match="document">
  +  <!--
  +    <xsl:message>
  +     ##  path = <xsl:value-of select="$path"/>
  +     ##  root = <xsl:value-of select="$root"/>
  +     ##  nopdf = '<xsl:value-of select="$nopdf"/>'
  +    </xsl:message>
  +  -->
       <div class="content">
         <xsl:if test="normalize-space(header/title)!=''">
           <table class="title">
  @@ -29,9 +58,11 @@
               <!--td align="center" width="80" nowrap><a href="" class="dida"><img
src="images/singlepage.gif"><br>
                 single page<br>
                 version</a></td-->
  -            <td align="center" width="80" nowrap="nowrap"><a href="{$resource}.pdf"
class="dida"><img border="0" src="{$skin-img-dir}/printer.gif"/><br/>
  +            <xsl:if test="$nopdf = ''"> <!-- nopdf flag unset -->
  +            <td align="center" width="80" nowrap="nowrap"><a href="{$filename-noext}.pdf"
class="dida"><img border="0" src="{$skin-img-dir}/printer.gif"/><br/>
                 print-friendly<br/>
                 version</a></td>
  +            </xsl:if>
             </tr>
           </table>
         </xsl:if>
  @@ -140,9 +171,9 @@
       </a>
     </xsl:template>
     <xsl:template match="p[@xml:space='preserve']">
  -  <div class="pre">
  -    <xsl:apply-templates/>
  -  </div>
  +    <div class="pre">
  +      <xsl:apply-templates/>
  +    </div>
     </xsl:template>
     <xsl:template match="source">
       <pre class="code">
  
  
  
  1.11      +31 -5     xml-forrest/src/resources/skins/forrest-site/xslt/html/site2xhtml.xsl
  
  Index: site2xhtml.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/forrest-site/xslt/html/site2xhtml.xsl,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- site2xhtml.xsl	2 Nov 2002 05:31:25 -0000	1.10
  +++ site2xhtml.xsl	2 Nov 2002 10:09:39 -0000	1.11
  @@ -1,18 +1,44 @@
   <?xml version="1.0"?>
  +<!--
  +site2xhtml.xsl is the final stage in HTML page production.  It merges HTML from
  +document2html.xsl, tab2menu.xsl and book2menu.xsl, and adds the site header,
  +footer, searchbar, css etc.  As input, it takes XML of the form:
  +
  +<site>
  +  <div class="menu">
  +    ...
  +  </div>
  +  <div class="tab">
  +    ...
  +  </div>
  +  <div class="content">
  +    ...
  +  </div>
  +</site>
  +
  +$Id$
  +-->
  +
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <!-- Default skinconf.xml in the skins/ directory -->
     <xsl:param name="config-file" select="'../../../../skinconf.xml'"/>
     <xsl:variable name="config" select="document($config-file)/skinconfig"/>
  -  <xsl:param name="dir" select="'UNDEFINED'"/>
  -  <xsl:param name="resource" select="'UNDEFINED'"/>
  +  <xsl:param name="path"/>
     <xsl:include href="dotdots.xsl"/>
  +  <xsl:include href="pathutils.xsl"/>
   
     <xsl:variable name="root">
       <xsl:call-template name="dotdots">
  -      <xsl:with-param name="path" select="$dir"/>
  +      <xsl:with-param name="path" select="$path"/>
       </xsl:call-template>
     </xsl:variable>
    
  +  <xsl:variable name="filename">
  +    <xsl:call-template name="filename">
  +      <xsl:with-param name="path" select="$path"/>
  +    </xsl:call-template>
  +  </xsl:variable>
  +  
     <xsl:variable name="skin-img-dir" select="concat(string($root), 'skin/images')"/>
     <xsl:variable name="spacer" select="concat($root, 'skin/images/spacer.gif')"/>
    
  @@ -166,7 +192,7 @@
             <font face="Arial, Helvetica, Sans-Serif" size="2">Copyright &#169;
             <xsl:value-of select="$config/year"/>&#160;<xsl:value-of
             select="$config/vendor"/> All rights reserved.<script language="JavaScript"
type="text/javascript"><![CDATA[<!--
  -              document.write(" - "+"Last Published: " + document.lastModified);
  +              document.write(". - "+"Last Published: " + document.lastModified);
               //  -->]]></script></font>
           </td>
         </tr>
  @@ -177,7 +203,7 @@
           </xsl:if>
         </td>
         <td class="logos" bgcolor="#CFDCED" align="right">
  -        <xsl:if test="$resource = 'index.html' and $config/credits">
  +        <xsl:if test="$filename = 'index.html' and $config/credits">
             <div align="right">
             <xsl:for-each select="$config/credits/credit">
               <xsl:variable name="name" select="name"/>
  
  
  
  1.5       +105 -52   xml-forrest/src/resources/skins/forrest-site/xslt/html/tab2menu.xsl
  
  Index: tab2menu.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/forrest-site/xslt/html/tab2menu.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- tab2menu.xsl	23 Sep 2002 07:47:41 -0000	1.4
  +++ tab2menu.xsl	2 Nov 2002 10:09:39 -0000	1.5
  @@ -1,12 +1,39 @@
   <?xml version="1.0"?>
  +<!--
  +This stylesheet generates 'tabs' at the top left of the Forrest skin.  Tabs are
  +visual indicators that a certain subsection of the URI space is being browsed.
  +For example, if we had tabs with paths:
  +
  +Tab1:  ''
  +Tab2:  'community'
  +Tab3:  'community/howto'
  +Tab4:  'community/howto/xmlform/index.html'
  +
  +Then if the current path was 'community/howto/foo', Tab3 would be highlighted.
  +The rule is: the tab with the longest path that forms a prefix of the current
  +path is enabled.
  +
  +The output of this stylesheet is HTML of the form:
  +    <div class="tab">
  +      ...
  +    </div>
  +
  +which is then merged by site2xhtml.xsl
  +
  +$Id$
  +-->
  +
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  -  <xsl:param name="resource" select="'UNDEFINED'"/>
  -  <xsl:param name="dir" select="'UNDEFINED'"/>
  +  <xsl:param name="path"/>
  +  <xsl:param name="dir_index" select="'index.html'"/>
     <xsl:include href="dotdots.xsl"/>
  +  <xsl:include href="pathutils.xsl"/>
   
  +  <!-- NOTE: Xalan has a bug (race condition?) where sometimes $root is only
  +  half-evaluated -->
     <xsl:variable name="root">
       <xsl:call-template name="dotdots">
  -      <xsl:with-param name="path" select="$dir"/>
  +      <xsl:with-param name="path" select="$path"/>
       </xsl:call-template>
     </xsl:variable>
   
  @@ -17,44 +44,22 @@
         <img src="{$root}skin/images/spacer.gif" width="8" height="8" alt=""/>
       </td>
     </xsl:template>
  -  
  -  <xsl:template name="not-selected">
  -      <td valign="bottom">
  -        <table cellspacing="0" cellpadding="0" border="0" height="25" summary="non selected
tab">
  -          <tr>
  -            <td bgcolor="#B2C4E0" width="5" valign="top"><img src="{$skin-img-dir}/tab-left.gif"
alt="" width="5" height="5" /></td>
  -            <td bgcolor="#B2C4E0" valign="middle">
  -              <a>
  -                <xsl:attribute name="href">
  -                  <xsl:value-of select="$root"/>
  -                  <xsl:if test="@dir != ''">
  -                    <xsl:value-of select="concat(translate(normalize-space(translate(@dir,
' /', '/ ')), ' /', '/ '), '/')"/>
  -                    <!-- The above expression strips duplicate and trailing /'s. Cunning
:) :) -->
  -                  </xsl:if>
  -                </xsl:attribute>
  -                <font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of
select="@label"/></font></a>
  -            </td>
  -            <td bgcolor="#B2C4E0" width="5" valign="top"><img src="{$skin-img-dir}/tab-right.gif"
alt="" width="5" height="5" />
  -            </td>
  -          </tr>
  -        </table>
  -      </td>
  -  </xsl:template>
  -  
  -  <xsl:template name="selected">
  -      <td valign="bottom">
  -        <table cellspacing="0" cellpadding="0" border="0" height="30" summary="selected
tab">
  -          <tr>
  -            <td bgcolor="#4C6C8F" width="5" valign="top"><img src="{$skin-img-dir}/tabSel-left.gif"
alt="" width="5" height="5" /></td>
  -            <td bgcolor="#4C6C8F" valign="middle">
  -              <font face="Arial, Helvetica, Sans-serif" size="2" color="#ffffff"><b><xsl:value-of
select="@label"/></b></font>
  -            </td>
  -            <td bgcolor="#4C6C8F" width="5" valign="top"><img src="{$skin-img-dir}/tabSel-right.gif"
alt="" width="5" height="5" /></td>
  -          </tr>
  -        </table>
  -      </td>
  -  </xsl:template>
  -  
  +
  +  <!--
  +  The longest path of any tab, whose path is a subset of the current URL.  Ie,
  +  the path of the 'current' tab.
  +  -->
  +  <xsl:variable name="longest-dir">
  +    <xsl:for-each select="/tabs/tab[starts-with($path, @dir|@href)]">
  +      <xsl:sort select="string-length(@dir|@href)" 
  +        data-type="number" order="descending" />
  +      <xsl:if test="position()=1">
  +        <xsl:value-of select="@dir|@href"/>
  +      </xsl:if>
  +    </xsl:for-each>
  +  </xsl:variable>
  +
  +
     <xsl:template match="tabs">
       <div class="tab">
         <table cellspacing="0" cellpadding="0" border="0" summary="tab bar">
  @@ -64,24 +69,72 @@
         </table>
       </div>
     </xsl:template>
  -  
  +
     <xsl:template match="tab">
       <xsl:call-template name="spacer"/>
       <xsl:choose>
  -      <xsl:when test="$resource!='' and @dir=''">
  -        <xsl:call-template name="not-selected"/>
  +      <xsl:when test="@dir = $longest-dir or @href = $longest-dir">
  +        <xsl:call-template name="selected"/>
         </xsl:when>
         <xsl:otherwise>
  -        <xsl:choose>
  -          <xsl:when test="starts-with($resource,@dir)">
  -           <xsl:call-template name="selected"/>
  -          </xsl:when>
  -          <xsl:otherwise>
  -            <xsl:call-template name="not-selected"/>
  -          </xsl:otherwise>
  -        </xsl:choose>
  +        <xsl:call-template name="not-selected"/>
         </xsl:otherwise>
       </xsl:choose>
  +  </xsl:template>
  +
  +  <xsl:template name="not-selected">
  +    <td valign="bottom">
  +      <table cellspacing="0" cellpadding="0" border="0" height="25" summary="non selected
tab">
  +        <tr>
  +          <td bgcolor="#B2C4E0" width="5" valign="top"><img src="{$skin-img-dir}/tab-left.gif"
alt="" width="5" height="5" /></td>
  +          <td bgcolor="#B2C4E0" valign="middle">
  +            <a>
  +              <xsl:attribute name="href">
  +                <xsl:if test="starts-with(@href, 'http')">  <!-- Absolute URL
-->
  +                  <xsl:value-of select="@href"/>
  +                </xsl:if>
  +                <xsl:if test="not(starts-with(@href, 'http'))">  <!-- Root-relative
path -->
  +                  <xsl:variable name="backpath">
  +                    <xsl:call-template name="dotdots">
  +                      <xsl:with-param name="path" select="$path"/>
  +                    </xsl:call-template>
  +                    <xsl:text>/</xsl:text>
  +                    <xsl:value-of select="@dir|@href"/>
  +                    <!-- If we obviously have a directory, add /index.html -->
  +                    <xsl:if test="@dir or substring(@href, string-length(@href),
  +                      string-length(@href)) = '/'">
  +                      <xsl:text>/</xsl:text>
  +                      <xsl:value-of select="$dir_index"/>
  +                    </xsl:if>
  +                  </xsl:variable>
  +
  +                  <xsl:value-of
  +                    select="translate(normalize-space(translate($backpath, ' /', '/ ')),
' /', '/ ')"/>
  +                  <!-- Link to backpath, normalizing slashes -->
  +                </xsl:if>
  +              </xsl:attribute>
  +              <font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of
select="@label"/></font>
  +            </a>
  +          </td>
  +          <td bgcolor="#B2C4E0" width="5" valign="top"><img src="{$skin-img-dir}/tab-right.gif"
alt="" width="5" height="5" />
  +          </td>
  +        </tr>
  +      </table>
  +    </td>
  +  </xsl:template>
  +
  +  <xsl:template name="selected">
  +    <td valign="bottom">
  +      <table cellspacing="0" cellpadding="0" border="0" height="30" summary="selected
tab">
  +        <tr>
  +          <td bgcolor="#4C6C8F" width="5" valign="top"><img src="{$skin-img-dir}/tabSel-left.gif"
alt="" width="5" height="5" /></td>
  +          <td bgcolor="#4C6C8F" valign="middle">
  +            <font face="Arial, Helvetica, Sans-serif" size="2" color="#ffffff"><b><xsl:value-of
select="@label"/></b></font>
  +          </td>
  +          <td bgcolor="#4C6C8F" width="5" valign="top"><img src="{$skin-img-dir}/tabSel-right.gif"
alt="" width="5" height="5" /></td>
  +        </tr>
  +      </table>
  +    </td>
     </xsl:template>
   
   </xsl:stylesheet>
  
  
  
  1.1                  xml-forrest/src/resources/skins/forrest-site/xslt/html/pathutils.xsl
  
  Index: pathutils.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
  PathUtils.xsl
  
  A set of XSLT templates useful for parsing URI paths:
  
  dirname: return the directory part of a path
  filename: return the file part of a path
  ext: return the last extension of the filename in a path
  filename-noext: return the file part of a path without its last extension
  
  @author Jeff Turner <jefft@apache.org>
  $Id: pathutils.xsl,v 1.1 2002/11/02 10:09:39 jefft Exp $
  -->
  
  <!-- Returns the directory part of a path.  Equivalent to Unix 'dirname'.
  Examples:
  '' -> ''
  'foo/index.html' -> 'foo/'
  -->
  <xsl:template name="dirname">
    <xsl:param name="path" />
    <xsl:if test="contains($path, '/')">
      <xsl:value-of select="concat(substring-before($path, '/'), '/')" />
      <xsl:call-template name="dirname">
        <xsl:with-param name="path"
          select="substring-after($path, '/')" />
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
  
  
  <!-- Returns the filename part of a path.  Equivalent to Unix 'basename'
  Examples:
  'index.html'  ->  'index.html' 
  'foo/bar/'  ->  '' 
  'foo/bar/index.html'  ->  'index.html' 
  -->
  <xsl:template name="filename">
    <xsl:param name="path"/>
    <xsl:choose>
      <xsl:when test="contains($path, '/')">
        <xsl:call-template name="filename">
          <xsl:with-param name="path" select="substring-after($path, '/')"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$path"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <!-- Returns the last extension of a filename in a path.
  Examples:
  'index.html'  ->  '.html' 
  'index.dtdx.html'  ->  '.html' 
  'foo/bar/'  ->  '' 
  'foo/bar/index.html'  ->  '.html' 
  'foo/bar/index'  ->  '' 
  -->
  <xsl:template name="ext">
    <xsl:param name="path"/>
    <xsl:param name="subflag"/> <!-- Outermost call? -->
    <xsl:choose>
      <xsl:when test="contains($path, '.')">
        <xsl:call-template name="ext">
          <xsl:with-param name="path" select="substring-after($path, '.')"/>
          <xsl:with-param name="subflag" select="'sub'"/>
        </xsl:call-template>
      </xsl:when>
      <!-- Handle extension-less filenames by returning '' -->
      <xsl:when test="not($subflag) and not(contains($path, '.'))">
        <xsl:text/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="concat('.', $path)"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <!-- Returns a filename of a path stripped of its last extension.
  Examples:
  'foo/bar/index.dtdx.html' -> 'index.dtdx'
  -->
  <xsl:template name="filename-noext">
    <xsl:param name="path"/>
    <xsl:variable name="filename">
      <xsl:call-template name="filename">
        <xsl:with-param name="path" select="$path"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="ext">
      <xsl:call-template name="ext">
        <xsl:with-param name="path" select="$filename"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:value-of select="substring($filename, 1, string-length($filename) - string-length($ext))"/>
  </xsl:template>
  
  <!--
  Uncomment this to test.
  Usage: saxon resource.xsl resource.xsl resource=foo/bar
  
  <xsl:param name="resource" select="'/foo/bar/index.html'"/>
  <xsl:template match="/">
    <xsl:message>
      resource= <xsl:value-of select="$resource"/>
      dirname= <xsl:call-template name="dirname">
        <xsl:with-param name="path" select="$resource"/>
      </xsl:call-template>
      filename= <xsl:call-template name="filename">
        <xsl:with-param name="path" select="$resource"/>
      </xsl:call-template>
      ext= <xsl:call-template name="ext">
        <xsl:with-param name="path" select="$resource"/>
      </xsl:call-template>
      filename-noext= <xsl:call-template name="filename-noext">
        <xsl:with-param name="path" select="$resource"/>
      </xsl:call-template>
    </xsl:message>
  </xsl:template>
  -->
  
  </xsl:stylesheet>
  
  
  

Mime
View raw message