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 2002/11/09 12:37:45 UTC

cvs commit: xml-forrest/src/resources/skins/forrest-site/xslt/html document2html.xsl tab2menu.xsl

jefft       2002/11/09 03:37:44

  Modified:    .        status.xml
               src/resources/skins/avalon-tigris/xslt/html
                        document2html.xsl
               src/resources/skins/forrest-site/xslt/html document2html.xsl
                        tab2menu.xsl
  Log:
  Render any @id as <a name="...">
  
  Revision  Changes    Path
  1.40      +4 -0      xml-forrest/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/xml-forrest/status.xml,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- status.xml	9 Nov 2002 07:00:30 -0000	1.39
  +++ status.xml	9 Nov 2002 11:37:44 -0000	1.40
  @@ -98,6 +98,10 @@
   
     <changes>
      <release version="0.1" date="2002">
  +    <action dev="JT" type="add" context="skins">
  +     Now an id attribute on any XML element below &lt;body&gt; will be rendered
  +     as an anchor which can be linked to.
  +    </action> 
       <action dev="JT" type="fix" context="webapp">
        Fixed webapp redirect problems under Tomcat and (sometimes) under Jetty.
       </action> 
  
  
  
  1.2       +42 -3     xml-forrest/src/resources/skins/avalon-tigris/xslt/html/document2html.xsl
  
  Index: document2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/avalon-tigris/xslt/html/document2html.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- document2html.xsl	5 Nov 2002 07:36:49 -0000	1.1
  +++ document2html.xsl	9 Nov 2002 11:37:44 -0000	1.2
  @@ -56,6 +56,7 @@
         <xsl:apply-templates select="body"/>
       </div>
     </xsl:template>
  +
     <xsl:template match="body">
       <xsl:if test="section and not($isfaq='true')">
         <ul class="minitoc">
  @@ -81,6 +82,19 @@
       </xsl:if>
       <xsl:apply-templates/>
     </xsl:template>
  +
  +
  +  <!-- Generate a <a name="..."> tag for an @id -->
  +  <xsl:template match="@id">
  +    <xsl:if test="normalize-space(.)!=''">
  +      <a>
  +        <xsl:attribute name="name">
  +          <xsl:value-of select="."/>
  +        </xsl:attribute>
  +      </a>
  +    </xsl:if>
  +  </xsl:template>
  +
     <!--  section handling
     - <a name/> anchors are added if the id attribute is specified
     - generated anchors are still included for TOC - what should we do about this?
  @@ -89,6 +103,7 @@
   -->
     <xsl:template match="section">
       <a name="{generate-id()}"/>
  +    <xsl:apply-templates select="@id"/>
       <xsl:if test="normalize-space(@id)!=''">
         <a name="{@id}"/>
       </xsl:if>
  @@ -99,8 +114,10 @@
       <xsl:apply-templates select="*[not(self::title)]"/>
       </div>
     </xsl:template>
  +
     <xsl:template match="section/section">
       <a name="{generate-id()}"/>
  +    <xsl:apply-templates select="@id"/>
       <xsl:if test="normalize-space(@id)!=''">
         <a name="{@id}"/>
       </xsl:if>
  @@ -111,7 +128,9 @@
       <xsl:apply-templates select="*[not(self::title)]"/>
       </div>
     </xsl:template>
  +
     <xsl:template match="note | warning | fixme">
  +    <xsl:apply-templates select="@id"/>
       <div class="frame {local-name()}">
         <div class="label">
           <xsl:choose>
  @@ -128,27 +147,37 @@
         </div>
       </div>
     </xsl:template>
  +
     <xsl:template match="link">
  +    <xsl:apply-templates select="@id"/>
       <a href="{@href}">
         <xsl:apply-templates/>
       </a>
     </xsl:template>
  +
     <xsl:template match="jump">
  +    <xsl:apply-templates select="@id"/>
       <a href="{@href}" target="_top">
         <xsl:apply-templates/>
       </a>
     </xsl:template>
  +
     <xsl:template match="fork">
  +    <xsl:apply-templates select="@id"/>
       <a href="{@href}" target="_blank">
         <xsl:apply-templates/>
       </a>
     </xsl:template>
  +
     <xsl:template match="p[@xml:space='preserve']">
  -  <div class="pre">
  -    <xsl:apply-templates/>
  -  </div>
  +    <xsl:apply-templates select="@id"/>
  +    <div class="pre">
  +      <xsl:apply-templates/>
  +    </div>
     </xsl:template>
  +
     <xsl:template match="source">
  +    <xsl:apply-templates select="@id"/>
       <pre class="code">
   <!-- Temporarily removed long-line-splitter ... gives out-of-memory problems -->
         <xsl:apply-templates/>
  @@ -160,10 +189,13 @@
   -->
       </pre>
     </xsl:template>
  +
     <xsl:template match="anchor">
       <a name="{@id}"/>
     </xsl:template>
  +
     <xsl:template match="icon">
  +    <xsl:apply-templates select="@id"/>
       <img src="{@src}" alt="{@alt}">
         <xsl:if test="@height">
           <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
  @@ -173,10 +205,14 @@
         </xsl:if>
       </img>
     </xsl:template>
  +
     <xsl:template match="code">
  +    <xsl:apply-templates select="@id"/>
       <span class="codefrag"><xsl:value-of select="."/></span>
     </xsl:template>
  +
     <xsl:template match="figure">
  +    <xsl:apply-templates select="@id"/>
       <div align="center">
         <img src="{@src}" alt="{@alt}" class="figure">
           <xsl:if test="@height">
  @@ -188,7 +224,9 @@
         </img>
       </div>
     </xsl:template>
  +
     <xsl:template match="table">
  +    <xsl:apply-templates select="@id"/>
       <table cellpadding="4" cellspacing="1" class="ForrestTable">
         <xsl:if test="@cellspacing"><xsl:attribute name="cellspacing"><xsl:value-of select="@cellspacing"/></xsl:attribute></xsl:if>
         <xsl:if test="@cellpadding"><xsl:attribute name="cellpadding"><xsl:value-of select="@cellpadding"/></xsl:attribute></xsl:if>
  @@ -198,6 +236,7 @@
         <xsl:apply-templates/>
       </table>
     </xsl:template>
  +
     <xsl:template match="node()|@*" priority="-1">
       <xsl:copy>
         <xsl:apply-templates select="@*"/>
  
  
  
  1.12      +44 -10    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- document2html.xsl	2 Nov 2002 10:09:39 -0000	1.11
  +++ document2html.xsl	9 Nov 2002 11:37:44 -0000	1.12
  @@ -59,9 +59,11 @@
                 single page<br>
                 version</a></td-->
               <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>
  +              <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>
  @@ -87,6 +89,7 @@
         <xsl:apply-templates select="body"/>
       </div>
     </xsl:template>
  +
     <xsl:template match="body">
       <xsl:if test="section and not($isfaq='true')">
         <ul class="minitoc">
  @@ -112,33 +115,44 @@
       </xsl:if>
       <xsl:apply-templates/>
     </xsl:template>
  +
     <!--  section handling
     - <a name/> anchors are added if the id attribute is specified
     - generated anchors are still included for TOC - what should we do about this?
     - FIXME: provide a generic facility to process section irrelevant to their
       nesting depth
   -->
  +
  +  <xsl:template match="@id">
  +    <xsl:if test="normalize-space(.)!=''">
  +      <a>
  +        <xsl:attribute name="name">
  +          <xsl:value-of select="."/>
  +        </xsl:attribute>
  +      </a>
  +    </xsl:if>
  +  </xsl:template>
  +
     <xsl:template match="section">
       <a name="{generate-id()}"/>
  -    <xsl:if test="normalize-space(@id)!=''">
  -      <a name="{@id}"/>
  -    </xsl:if>
  +    <xsl:apply-templates select="@id"/>
       <h3>
         <xsl:value-of select="title"/>
       </h3>
       <xsl:apply-templates select="*[not(self::title)]"/>
     </xsl:template>
  +
     <xsl:template match="section/section">
       <a name="{generate-id()}"/>
  -    <xsl:if test="normalize-space(@id)!=''">
  -      <a name="{@id}"/>
  -    </xsl:if>
  +    <xsl:apply-templates select="@id"/>
       <h4>
         <xsl:value-of select="title"/>
       </h4>
       <xsl:apply-templates select="*[not(self::title)]"/>
     </xsl:template>
  +
     <xsl:template match="note | warning | fixme">
  +    <xsl:apply-templates select="@id"/>
       <div class="frame {local-name()}">
         <div class="label">
           <xsl:choose>
  @@ -155,27 +169,37 @@
         </div>
       </div>
     </xsl:template>
  +
     <xsl:template match="link">
  +    <xsl:apply-templates select="@id"/>
       <a href="{@href}">
         <xsl:apply-templates/>
       </a>
     </xsl:template>
  +
     <xsl:template match="jump">
  +    <xsl:apply-templates select="@id"/>
       <a href="{@href}" target="_top">
         <xsl:apply-templates/>
       </a>
     </xsl:template>
  +
     <xsl:template match="fork">
  +    <xsl:apply-templates select="@id"/>
       <a href="{@href}" target="_blank">
         <xsl:apply-templates/>
       </a>
     </xsl:template>
  +
     <xsl:template match="p[@xml:space='preserve']">
  +    <xsl:apply-templates select="@id"/>
       <div class="pre">
         <xsl:apply-templates/>
       </div>
     </xsl:template>
  +
     <xsl:template match="source">
  +    <xsl:apply-templates select="@id"/>
       <pre class="code">
   <!-- Temporarily removed long-line-splitter ... gives out-of-memory problems -->
         <xsl:apply-templates/>
  @@ -187,10 +211,13 @@
   -->
       </pre>
     </xsl:template>
  +
     <xsl:template match="anchor">
       <a name="{@id}"/>
     </xsl:template>
  +
     <xsl:template match="icon">
  +    <xsl:apply-templates select="@id"/>
       <img src="{@src}" alt="{@alt}">
         <xsl:if test="@height">
           <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
  @@ -200,10 +227,14 @@
         </xsl:if>
       </img>
     </xsl:template>
  +
     <xsl:template match="code">
  +    <xsl:apply-templates select="@id"/>
       <span class="codefrag"><xsl:value-of select="."/></span>
     </xsl:template>
  +
     <xsl:template match="figure">
  +    <xsl:apply-templates select="@id"/>
       <div align="center">
         <img src="{@src}" alt="{@alt}" class="figure">
           <xsl:if test="@height">
  @@ -215,7 +246,9 @@
         </img>
       </div>
     </xsl:template>
  +
     <xsl:template match="table">
  +    <xsl:apply-templates select="@id"/>
       <table cellpadding="4" cellspacing="1" class="ForrestTable">
         <xsl:if test="@cellspacing"><xsl:attribute name="cellspacing"><xsl:value-of select="@cellspacing"/></xsl:attribute></xsl:if>
         <xsl:if test="@cellpadding"><xsl:attribute name="cellpadding"><xsl:value-of select="@cellpadding"/></xsl:attribute></xsl:if>
  @@ -225,6 +258,7 @@
         <xsl:apply-templates/>
       </table>
     </xsl:template>
  +
     <xsl:template match="node()|@*" priority="-1">
       <xsl:copy>
         <xsl:apply-templates select="@*"/>
  
  
  
  1.6       +6 -7      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- tab2menu.xsl	2 Nov 2002 10:09:39 -0000	1.5
  +++ tab2menu.xsl	9 Nov 2002 11:37:44 -0000	1.6
  @@ -29,8 +29,7 @@
     <xsl:include href="dotdots.xsl"/>
     <xsl:include href="pathutils.xsl"/>
   
  -  <!-- NOTE: Xalan has a bug (race condition?) where sometimes $root is only
  -  half-evaluated -->
  +  <!-- 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="$path"/>
  @@ -46,13 +45,13 @@
     </xsl:template>
   
     <!--
  -  The longest path of any tab, whose path is a subset of the current URL.  Ie,
  -  the path of the 'current' tab.
  +    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:sort select="string-length(@dir|@href)"
  +                data-type="number" order="descending"/>
         <xsl:if test="position()=1">
           <xsl:value-of select="@dir|@href"/>
         </xsl:if>