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/stylesheets site2site-normalizetabs.xsl site2site-selectnode.xsl site2site-normalizetabs.xml
Date Tue, 03 Jun 2003 10:09:04 GMT
jefft       2003/06/03 03:09:04

  Modified:    .        status.xml
               src/resources/conf linkmap.xmap navigation.xmap sitemap.xmap
  Added:       src/resources/conf linkmap-tabs.xmap
               src/resources/stylesheets site2site-normalizetabs.xsl
                        site2site-selectnode.xsl
  Removed:     src/resources/stylesheets site2site-normalizetabs.xml
  Log:
  Add first cut implementation of @tab menu/tab selection.
  
  Revision  Changes    Path
  1.165     +4 -0      xml-forrest/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/xml-forrest/status.xml,v
  retrieving revision 1.164
  retrieving revision 1.165
  diff -u -r1.164 -r1.165
  --- status.xml	2 Jun 2003 03:18:25 -0000	1.164
  +++ status.xml	3 Jun 2003 10:09:03 -0000	1.165
  @@ -24,6 +24,10 @@
   
     <changes>
       <release version="0.5-dev" date="unreleased">
  +      <action dev="JT" type="add" context="core">
  +        Added alternative menu/tab selection algorithm, that uses tab attributes
  +        in site.xml instead of relying on physical site structure (directories).
  +      </action>
         <action dev="JT" type="fix" context="core">
           In PDFs, section titles are no longer numbered/reduced in size indefinitely.
         </action>
  
  
  
  1.6       +2 -2      xml-forrest/src/resources/conf/linkmap.xmap
  
  Index: linkmap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/conf/linkmap.xmap,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- linkmap.xmap	2 Jun 2003 07:16:31 -0000	1.5
  +++ linkmap.xmap	3 Jun 2003 10:09:03 -0000	1.6
  @@ -21,7 +21,7 @@
           <map:serialize type="xml" />
         </map:match>
   
  -      <map:match pattern="abs-linkmap/**">
  +      <map:match type="regexp" pattern="^abs-linkmap/(.*?)([^/]*)$">
           <map:generate src="cocoon://abs-linkmap" />
           <map:transform type="xpath">
             <map:parameter name="include" value="//*[@href='{1}']" />
  @@ -41,7 +41,7 @@
         site.xml.  The /** suffix identifies a @href prefix which all nodes in the
         returned subtree must have. -->
         <map:match pattern="**linkmap/**">
  -        <map:generate src="cocoon://abs-linkmap/{1}" />
  +        <map:generate src="cocoon://abs-linkmap/{2}" />
           <map:transform src="resources/stylesheets/relativize-linkmap.xsl">
             <map:parameter name="path" value="{1}linkmap" />
           </map:transform>
  
  
  
  1.7       +5 -3      xml-forrest/src/resources/conf/navigation.xmap
  
  Index: navigation.xmap
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/conf/navigation.xmap,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- navigation.xmap	2 Jun 2003 05:42:29 -0000	1.6
  +++ navigation.xmap	3 Jun 2003 10:09:03 -0000	1.7
  @@ -21,7 +21,7 @@
         </map:act>
   
         <!-- If no book.xml, generate it from the linkmap. -->
  -      <map:generate src="cocoon://{dir}linkmap/{dir}" />
  +      <map:generate src="cocoon://{dir}linkmap/{path}" />
         <!-- The above generates the subset of the linkmap relevant to our directory.
-->
         <map:transform src="resources/stylesheets/site2book.xsl" />
         <map:serialize type="xml"/>
  @@ -31,15 +31,17 @@
     <map:pipelines>
       <map:pipeline>
   
  -      <map:match pattern="**/book.xml">
  +      <map:match pattern="**/book-*.xml">
           <map:call resource="book">
             <map:parameter name="dir" value="{1}/" />
  +          <map:parameter name="path" value="{1}/{2}" />
           </map:call>
         </map:match>
   
  -      <map:match pattern="book.xml">
  +      <map:match pattern="book-*.xml">
           <map:call resource="book">
             <map:parameter name="dir" value="" />
  +          <map:parameter name="path" value="{1}" />
           </map:call>
         </map:match>
   
  
  
  
  1.100     +2 -2      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.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- sitemap.xmap	2 Jun 2003 05:40:01 -0000	1.99
  +++ sitemap.xmap	3 Jun 2003 10:09:03 -0000	1.100
  @@ -249,7 +249,7 @@
         </map:match>
   
         <map:match pattern="**menu-*.xml">
  -        <map:generate src="cocoon:/{1}book.xml"/>
  +        <map:generate src="cocoon:/{1}book-{2}.xml"/>
           <map:transform type="linkrewriter" src="cocoon:/{1}linkmap">
             <map:parameter name="schemes" value="site ext"/>
           </map:transform>
  @@ -277,7 +277,7 @@
       <!-- ============================================================ -->
       <map:pipeline internal-only="false">
    
  -      <map:match pattern="**book.xml">
  +      <map:match pattern="**book-*.xml">
           <map:mount uri-prefix="" src="navigation.xmap" check-reload="yes" />
         </map:match>
   
  
  
  
  1.1                  xml-forrest/src/resources/conf/linkmap-tabs.xmap
  
  Index: linkmap-tabs.xmap
  ===================================================================
  <?xml version="1.0"?>
  <!-- A variant of linkmap.xmap that supports @tab attributes in site.xml -->
  
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <map:components>
      <map:generators default="file"/>
      <map:serializers default="html"/>
      <map:transformers default="xslt"/>
      <map:readers default="resource"/>
      <map:matchers default="wildcard"/>
      <map:selectors default="browser"/>
    </map:components>
  
    <map:resources>
    </map:resources>
  
    <map:pipelines>
      <map:pipeline>
  
        <map:match pattern="abs-linkmap">
          <map:generate src="content/xdocs/site.xml" />
          <map:transform src="resources/stylesheets/absolutize-linkmap.xsl" />
          <map:transform src="resources/stylesheets/site2site-normalizetabs.xsl" />
          <map:serialize type="xml" />
        </map:match>
  
        <map:match pattern="abs-linkmap/**">
          <map:generate src="cocoon:/abs-linkmap" />
          <map:transform src="resources/stylesheets/site2site-selectnode.xsl">
            <map:parameter name="path" value="{1}"/>
          </map:transform>
          <map:serialize type="xml" />
        </map:match>
  
        <map:match pattern="**linkmap">
          <map:generate src="cocoon://abs-linkmap" />
          <map:transform src="resources/stylesheets/relativize-linkmap.xsl">
            <map:parameter name="path" value="{0}" />
          </map:transform>
          <map:serialize type="xml" />
        </map:match>
  
        <!-- This derivation of '**linkmap' is used when generating book.xml from a
        site.xml.  The /** suffix identifies a @href prefix which all nodes in the
        returned subtree must have. -->
        <map:match pattern="**linkmap/**">
          <map:generate src="cocoon://abs-linkmap/{2}" />
          <map:transform src="resources/stylesheets/relativize-linkmap.xsl">
            <map:parameter name="path" value="{1}" />
          </map:transform>
          <map:serialize type="xml" />
        </map:match>
      </map:pipeline>
    </map:pipelines>
  
  </map:sitemap>
  
  
  
  
  1.1                  xml-forrest/src/resources/stylesheets/site2site-normalizetabs.xsl
  
  Index: site2site-normalizetabs.xsl
  ===================================================================
  <?xml version="1.0"?>
  <!--
  Stylesheet to inherit @tab attributes if a node doesn't have one itself. Eg, given as input:
  
  <site href="">
    <index href="index.html"/>
    <community href="community/" tab="community">
      <faq href="faq.html">
        <how_can_I_help href="#help"/>
      </faq>
      <howto tab="howto">
        <cvs href="cvs-howto.html"/>
      </howto>
    </community>
  </site>
  
  Output would be:
  
  <site href="">
    <index href="index.html"/>
    <community tab="community" href="community/">
      <faq tab="community" href="faq.html">
        <how_can_I_help tab="community" href="#help"/>
      </faq>
      <howto tab="howto">
        <cvs tab="howto" href="cvs-howto.html"/>
      </howto>
    </community>
  </site>
  
  Jeff Turner <jefft@apache.org>
  -->
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:l="http://apache.org/forrest/linkmap/1.0">
  
    <!-- Return a value for a node's @tab, either using an existing @tab or the first ancestor's
-->
    <xsl:template name="gettab">
      <xsl:param name="node"/>
      <xsl:choose>
        <xsl:when test="$node/@tab">
          <xsl:value-of select="$node/@tab"/>
        </xsl:when>
        <xsl:when test="$node/..">
          <xsl:call-template name="gettab">
            <xsl:with-param name="node" select="$node/.."/>
          </xsl:call-template>
        </xsl:when>
      </xsl:choose>
    </xsl:template>
  
    <xsl:template match="//*">
      <xsl:variable name="newtab">
        <xsl:call-template name="gettab">
          <xsl:with-param name="node" select="."/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:copy>
        <!-- <xsl:if test="not(normalize-space($newtab)='')"> -->
          <xsl:attribute name="tab">
            <xsl:value-of select="$newtab"/>
          </xsl:attribute>
          <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>
  
    <xsl:template match="@*|node()" priority="-1">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  xml-forrest/src/resources/stylesheets/site2site-selectnode.xsl
  
  Index: site2site-selectnode.xsl
  ===================================================================
  <?xml version="1.0"?>
  <!--
  This stylesheet selects a set of nodes with @tab equal to that of a node whose @href matches
an input parameter.  Could
  probably be done with 2 lines of XQuery.
  
  Jeff Turner <jefft@apache.org>
  -->
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:l="http://apache.org/forrest/linkmap/1.0">
  
    <xsl:output indent="yes"/>
  
    <xsl:param name="path" select="'index'"/>
  
    <xsl:variable name="tab">
      <xsl:value-of select="string(//*[starts-with(@href, $path)]/@tab)"/>
    </xsl:variable>
  
    <xsl:template match="/*">
      <xsl:message>## path is <xsl:value-of select="$path"/></xsl:message>
      <xsl:message>## tab is <xsl:value-of select="$tab"/></xsl:message>
      <xsl:copy>
        <xsl:apply-templates/>
      </xsl:copy>
    </xsl:template>
  
    <xsl:template match="*">
      <xsl:choose>
        <!-- Take out the first test to not duplicate other tabs' content in first menu
-->
        <xsl:when test="$tab='' or @tab=$tab">
          <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
          </xsl:copy>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="*"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
  
    <xsl:template match="@*|node()" priority="-1">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>
  </xsl:stylesheet>
  
  
  

Mime
View raw message