You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/03/22 17:36:09 UTC

svn commit: r521331 - in /lenya/trunk/src/modules/collection: config/cocoon-xconf/resourcetype-collection.xconf samples/children.xml sitemap.xmap xslt/ xslt/collection2cinclude.xsl xslt/sitetree2children.xsl

Author: andreas
Date: Thu Mar 22 09:36:08 2007
New Revision: 521331

URL: http://svn.apache.org/viewvc?view=rev&rev=521331
Log:
Added option to generate child collection dynamically

Added:
    lenya/trunk/src/modules/collection/samples/children.xml
    lenya/trunk/src/modules/collection/sitemap.xmap
    lenya/trunk/src/modules/collection/xslt/
    lenya/trunk/src/modules/collection/xslt/collection2cinclude.xsl
    lenya/trunk/src/modules/collection/xslt/sitetree2children.xsl
Modified:
    lenya/trunk/src/modules/collection/config/cocoon-xconf/resourcetype-collection.xconf

Modified: lenya/trunk/src/modules/collection/config/cocoon-xconf/resourcetype-collection.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/collection/config/cocoon-xconf/resourcetype-collection.xconf?view=diff&rev=521331&r1=521330&r2=521331
==============================================================================
--- lenya/trunk/src/modules/collection/config/cocoon-xconf/resourcetype-collection.xconf (original)
+++ lenya/trunk/src/modules/collection/config/cocoon-xconf/resourcetype-collection.xconf Thu Mar 22 09:36:08 2007
@@ -23,7 +23,8 @@
   <component-instance name="collection"
                       logger="lenya.resourcetypes.collectoin"
                       class="org.apache.lenya.cms.publication.ResourceTypeImpl">
-    <sample-name>fallback://lenya/modules/collection/samples/collection.xml</sample-name>
+    <sample-name name="Manual">fallback://lenya/modules/collection/samples/collection.xml</sample-name>
+    <sample-name name="Children">fallback://lenya/modules/collection/samples/children.xml</sample-name>
   </component-instance>
 
 </xconf>

Added: lenya/trunk/src/modules/collection/samples/children.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/collection/samples/children.xml?view=auto&rev=521331
==============================================================================
--- lenya/trunk/src/modules/collection/samples/children.xml (added)
+++ lenya/trunk/src/modules/collection/samples/children.xml Thu Mar 22 09:36:08 2007
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<collection xmlns="http://apache.org/cocoon/lenya/collection/1.0" type="children"/>

Added: lenya/trunk/src/modules/collection/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/collection/sitemap.xmap?view=auto&rev=521331
==============================================================================
--- lenya/trunk/src/modules/collection/sitemap.xmap (added)
+++ lenya/trunk/src/modules/collection/sitemap.xmap Thu Mar 22 09:36:08 2007
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Id: doctypes.xmap 179488 2005-06-02 02:29:39Z gregor $ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Components ================================ -->
+
+  <map:pipelines>
+
+    <map:pipeline>
+
+      <!-- collectionWithChildren/{uuid}.xml -->
+      <map:match pattern="collectionWithChildren/*.xml">
+        <map:generate type="sitetree-fragment">
+          <map:parameter name="areas" value="{page-envelope:area}"/>
+          <map:parameter name="area" value="{page-envelope:area}"/>
+          <map:parameter name="path" value="{doc-info:{page-envelope:publication-id}:{page-envelope:area}:{1}:{page-envelope:document-language}:path}"/>
+          <map:parameter name="initial" value="false"/>
+          <map:parameter name="mimetype" value=""/>
+        </map:generate>
+        <map:transform src="fallback://lenya/modules/collection/xslt/sitetree2children.xsl"/>
+        <map:transform src="fallback://lenya/modules/collection/xslt/collection2cinclude.xsl">
+          <map:parameter name="uuid" value="{1}"/>
+        </map:transform>
+        <map:transform type="cinclude"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <!-- metadata-{uuid}.xml -->
+      <map:match pattern="metadata-*.xml">
+        <map:generate type="lenyaMetaData">
+          <map:parameter name="pubid" value="{page-envelope:publication-id}"/>
+          <map:parameter name="area" value="{page-envelope:area}"/>
+          <map:parameter name="uuid" value="{1}"/>
+          <map:parameter name="lang" value="{page-envelope:document-language}"/>
+        </map:generate>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+    </map:pipeline>
+    
+  </map:pipelines>
+</map:sitemap>

Added: lenya/trunk/src/modules/collection/xslt/collection2cinclude.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/collection/xslt/collection2cinclude.xsl?view=auto&rev=521331
==============================================================================
--- lenya/trunk/src/modules/collection/xslt/collection2cinclude.xsl (added)
+++ lenya/trunk/src/modules/collection/xslt/collection2cinclude.xsl Thu Mar 22 09:36:08 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+  xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
+  xmlns:ci="http://apache.org/cocoon/include/1.0">
+  
+  
+  <xsl:param name="uuid"/>
+  
+  
+  <xsl:template match="col:collection">
+    <xsl:choose>
+      <xsl:when test="@type = 'children'">
+        <ci:include src="cocoon://modules/collection/collectionWithChildren/{$uuid}.xml"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:copy-of select="@*"/>
+          <ci:include src="cocoon://modules/collection/metadata-{$uuid}.xml"/>
+          <xsl:apply-templates select="col:document"/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  
+  <xsl:template match="col:document">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <ci:include src="cocoon://modules/collection/metadata-{@uuid}.xml"/>
+      <ci:include src="lenya-document:{@uuid}"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+</xsl:stylesheet>
\ No newline at end of file

Added: lenya/trunk/src/modules/collection/xslt/sitetree2children.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/collection/xslt/sitetree2children.xsl?view=auto&rev=521331
==============================================================================
--- lenya/trunk/src/modules/collection/xslt/sitetree2children.xsl (added)
+++ lenya/trunk/src/modules/collection/xslt/sitetree2children.xsl Thu Mar 22 09:36:08 2007
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+  xmlns:site="http://apache.org/cocoon/lenya/sitetree/1.0"
+  xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
+  xmlns:ci="http://apache.org/cocoon/include/1.0">
+  
+  
+  <xsl:template match="site:fragment">
+    <col:collection>
+      <xsl:apply-templates select="site:node"/>
+    </col:collection>
+  </xsl:template>
+  
+  
+  <xsl:template match="site:node">
+    <col:document uuid="{@uuid}"/>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org