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/conf cocoon.xconf sitemap.xmap
Date Thu, 26 Dec 2002 14:18:29 GMT
jefft       2002/12/26 06:18:28

  Modified:    src/resources/conf Tag: LINKMAP_BRANCH cocoon.xconf
                        sitemap.xmap
  Log:
  Implement site: scheme using LinkRewriterTransformer
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.1   +19 -1     xml-forrest/src/resources/conf/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/conf/cocoon.xconf,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- cocoon.xconf	26 Dec 2002 08:33:12 -0000	1.8
  +++ cocoon.xconf	26 Dec 2002 14:18:28 -0000	1.8.2.1
  @@ -465,7 +465,25 @@
   	     <input-module name="session-attr"/>
   	     <input-module name="defaults"/>
   	  </component-instance>
  -	  
  +
  +
  +      <!-- For the site: scheme -->
  +      <component-instance
  +        class="org.apache.cocoon.components.modules.input.XMLFileModule"
  +        logger="core.modules.xml" name="linkmap">
  +        <file src="cocoon://samples/linkrewriter/sitedemo/linkmap"/>
  +        <!-- Shouldn't this be the default? -->
  +        <reloadable>true</reloadable>
  +      </component-instance>
  +       <component-instance
  +         class="org.apache.cocoon.components.modules.input.SimpleMappingMetaModule"
  +         logger="core.modules.mapper" name="site">
  +         <input-module name="linkmap"/>
  +         <prefix>/site/</prefix>
  +         <suffix>/@href</suffix>
  +       </component-instance>
  +
  +
      </input-modules>
   
      <output-modules>
  
  
  
  1.45.2.1  +79 -13    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.45
  retrieving revision 1.45.2.1
  diff -u -r1.45 -r1.45.2.1
  --- sitemap.xmap	26 Dec 2002 08:33:12 -0000	1.45
  +++ sitemap.xmap	26 Dec 2002 14:18:28 -0000	1.45.2.1
  @@ -23,6 +23,21 @@
       <use-browser-capabilities-db>false</use-browser-capabilities-db>
      </map:transformer>
     -->
  +    <map:transformer name="linkrewriter"
  +      src="org.apache.cocoon.transformation.LinkRewriterTransformer">
  +      <input-module name="linkmap" src="{src}" reloadable="true"/>
  +      <input-module name="site">
  +        <input-module name="linkmap" src="{src}" reloadable="true"/>
  +        <prefix>/site//</prefix>
  +        <suffix>/@href</suffix>
  +      </input-module>
  +    </map:transformer>
  +    <map:transformer name="xpath"
  +       logger="sitemap.transformer.xpath"
  +       src="org.apache.cocoon.transformation.XPathTransformer"
  +     />
  +
  + 
       <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"
                           logger="sitemap.transformer.xsltc"
                           pool-max="32" pool-min="8" pool-grow="2">
  @@ -142,7 +157,22 @@
     </map:resource>
   
     <map:resource name="book">
  -    <map:generate src="content/xdocs/{../1}book.xml"/>
  +    <map:act type="resource-exists">
  +      <!-- If a hand-created book.xml exists, use it -->
  +      <map:parameter name="url" value="content/xdocs/{dir}book.xml"/>
  +      <map:generate src="content/xdocs/{../dir}book.xml"/>
  +      <map:call resource="skinit">
  +        <map:parameter name="type" value="book2menu"/>
  +        <map:parameter name="path" value="{../path}"/>
  +      </map:call>
  +    </map:act>
  +
  +    <!-- If no book.xml, generate it from the linkmap. -->
  +
  +    <map:generate src="cocoon:/{dir}linkmap/{dir}"/>
  +    <!-- The above generates the subset of the linkmap relevant to our
  +    directory. -->
  +    <map:transform src="library/xslt/site2book.xsl"/>
       <map:call resource="skinit">
         <map:parameter name="type" value="book2menu"/>
         <map:parameter name="path" value="{path}"/>
  @@ -175,7 +205,7 @@
     
     <!-- Pipeline that manages the internal URI space
          For the external URI space manager, see the next pipeline. -->
  -  <map:pipeline internal-only="true">
  +  <map:pipeline>
   
     <map:match pattern="**tab-**.xml">
       <map:generate src="content/xdocs/tabs.xml"/>
  @@ -187,12 +217,14 @@
   
     <map:match pattern="**book-**/*.xml">
       <map:call resource="book">
  -     <map:parameter name="path" value="{2}/{3}.xml"/>
  +      <map:parameter name="dir" value="{2}/"/>
  +      <map:parameter name="path" value="{2}/{3}.xml"/>
       </map:call>
     </map:match>
   
     <map:match pattern="**book-**.xml">
       <map:call resource="book">
  +      <map:parameter name="dir" value=""/>
         <map:parameter name="path" value="{2}.xml"/>
       </map:call>
     </map:match>
  @@ -237,12 +269,6 @@
        </map:call>
      </map:match>
   
  -
  -   <!-- Redirect requests for community/ (eg in the trail) to the home page -->
  -   <map:match pattern="community/index.html">
  -     <map:redirect-to uri="../index.html"/>
  -   </map:match>
  -
      <!-- index pages for contribution categories -->
      <map:match pattern="body-community/*/index.xml">
        <map:generate src="content/xdocs/community/{1}/index.xml"/>
  @@ -332,6 +358,7 @@
      <!-- Generates body HTML for files in subdirs -->
      <map:match pattern="body-**/*.xml">
       <map:generate src="content/xdocs/{1}/{2}.xml"/>
  +    <map:transform type="linkrewriter" src="cocoon:/{1}/linkmap"/>
       <map:call resource="transform-to-document">
        <map:parameter name="src" value="content/xdocs/{1}/{2}.xml"/>
       </map:call>
  @@ -344,6 +371,9 @@
      <!-- Generates body HTML for root-level files -->
      <map:match pattern="body-**.xml">
       <map:generate src="content/xdocs/{1}.xml"/>
  +    <map:transform type="linkrewriter" src="cocoon:/linkmap">
  +     <map:parameter name="bad-link-str" value="badlink"/>
  +    </map:transform>
       <map:call resource="transform-to-document">
        <map:parameter name="src" value="content/xdocs/{1}.xml"/>
       </map:call>
  @@ -352,6 +382,42 @@
        <map:parameter name="path" value="{1}.xml"/>
       </map:call>
      </map:match>
  + </map:pipeline>
  +
  +
  + <map:pipeline>
  +   <map:match pattern="abs-linkmap">
  +     <map:generate src="content/xdocs/site.xml"/>
  +     <map:transform src="library/xslt/absolutize-linkmap.xsl"/>
  +     <map:serialize type="xml"/>
  +   </map:match>
  +
  +   <map:match pattern="abs-linkmap/**">
  +     <map:generate src="cocoon:/abs-linkmap"/>
  +     <map:transform type="xpath">
  +       <map:parameter name="include" value="//*[@href='{1}']"/>
  +     </map:transform>
  +     <map:serialize type="xml"/>
  +   </map:match>
  +
  +   <map:match pattern="**linkmap">
  +     <map:generate src="cocoon:/abs-linkmap"/>
  +     <map:transform src="library/xslt/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="library/xslt/relativize-linkmap.xsl">
  +       <map:parameter name="path" value="{1}linkmap"/>
  +     </map:transform>
  +     <map:serialize type="xml"/>
  +   </map:match>
   
     </map:pipeline>
   
  @@ -362,7 +428,7 @@
      <map:match pattern="edit**">
        <map:mount uri-prefix="edit" src="editor.xmap" check-reload="yes"/>
      </map:match>
  -   
  +
      <!-- ==================   External URI-space    ========================= -->
  
   
   
  @@ -474,7 +540,7 @@
      <!-- ================  Directory redirects   =========================== -->
      <!-- Redirect any request for a directory to the directory's index.html file  -->
      <map:match pattern="**/">
  -     <map:redirect-to uri="{request:contextPath}/{1}/index.html"/>
  +    <map:redirect-to uri="{request:contextPath}/{1}/index.html"/>
      </map:match>
   
      <!-- ================  Libre   =========================== -->
  @@ -564,8 +630,8 @@
      </map:match>
   
      </map:match>
  -   
  -  </map:pipeline>
  +
  + </map:pipeline>
    </map:pipelines>
   
   </map:sitemap>
  
  
  

Mime
View raw message