You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gi...@apache.org on 2007/05/15 08:40:15 UTC
svn commit: r538070 - in
/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources:
COB-INF/ COB-INF/blocks/ COB-INF/common/style/xsl/html/
COB-INF/resources/samples/ COB-INF/resources/samples/common/
COB-INF/resources/s...
Author: giacomo
Date: Mon May 14 23:40:14 2007
New Revision: 538070
URL: http://svn.apache.org/viewvc?view=rev&rev=538070
Log:
make it a service block so that samples can start using it as a block
Added:
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/directory2xsamples.xsl (with props)
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/dynamic-page2html.xsl (with props)
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/filter-blocks.xsl (with props)
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/xsl/
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/xsl/html/
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/xsl/html/simple-samples2html.xsl (with props)
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/META-INF/cocoon/
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/META-INF/cocoon/spring/
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/META-INF/cocoon/spring/cocoon-samples-style-default-blockServlet.xml (with props)
Modified:
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-page2html.xsl
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-samples2html.xsl
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/sitemap.xmap
cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/stylesheets/system/xml2html.xslt
Added: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/directory2xsamples.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/directory2xsamples.xsl?view=auto&rev=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/directory2xsamples.xsl (added)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/directory2xsamples.xsl Mon May 14 23:40:14 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<!-- CVS $Id: directory2xsamples.xsl 448464 2006-09-21 05:29:11Z crossley $ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:dir="http://apache.org/cocoon/directory/2.0"
+ exclude-result-prefixes="dir">
+
+ <xsl:template match="/dir:directory">
+ <xsamples>
+ <xsl:apply-templates select="*"/>
+ </xsamples>
+ </xsl:template>
+
+ <xsl:template match="dir:directory">
+ <xsl:apply-templates select="*"/>
+ </xsl:template>
+
+ <xsl:template match="dir:file">
+ <xsl:variable name="blockName" select="parent::dir:directory/@name"/>
+ <xsl:if test="substring-before(@name, '.xsamples')">
+ <sample name="cocoon-block-{$blockName}" block-name="{$blockName}">
+ <xsl:copy-of select=".//xsamples"/>
+ </sample>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/directory2xsamples.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/dynamic-page2html.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/dynamic-page2html.xsl?view=auto&rev=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/dynamic-page2html.xsl (added)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/dynamic-page2html.xsl Mon May 14 23:40:14 2007
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xsp-request="http://apache.org/xsp/request/2.0"
+ xmlns:xsp="http://apache.org/xsp">
+
+ <xsl:include href="../common/style/xsl/html/simple-page2html.xsl"/>
+
+ <xsl:template match="xsp-request:uri">
+ <b><xsl:value-of select="."/></b>
+ </xsl:template>
+
+ <xsl:template match="xsp-request:parameter">
+ <i><xsl:value-of select="@name"/></i>:<b><xsl:value-of select="."/></b>
+ </xsl:template>
+
+ <xsl:template match="xsp-request:parameter-values">
+ <p>Parameter Values for "<xsl:value-of select="@name"/>":</p>
+
+ <ul>
+ <xsl:for-each select="xsp-request:value">
+ <li>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+
+ <xsl:template match="xsp-request:parameter-names">
+ <p>All Parameter Names:</p>
+
+ <ul>
+ <xsl:for-each select="xsp-request:name">
+ <li>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+
+ <xsl:template match="xsp-request:headers">
+ <p>Headers:</p>
+
+ <ul>
+ <xsl:for-each select="xsp-request:header">
+ <li>
+ <i><xsl:value-of select="@name"/></i>:
+ <b><xsl:value-of select="."/></b>
+ </li>
+ </xsl:for-each>
+ </ul>
+ <br/>
+ </xsl:template>
+
+ <xsl:template match="xsp-request:header">
+ <i><xsl:value-of select="@name"/></i>:<b><xsl:value-of select="."/></b>
+ </xsl:template>
+
+ <xsl:template match="xsp-request:header-names">
+ <p>All Header names:</p>
+
+ <ul>
+ <xsl:for-each select="xsp-request:name">
+ <li>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+
+
+
+ <xsl:template match="textarea/xsp-request:uri">
+ <xsl:call-template name="copy"/>
+ </xsl:template>
+
+ <xsl:template match="textarea/xsp-request:parameter">
+ <xsl:call-template name="copy"/>
+ </xsl:template>
+
+ <xsl:template match="textarea/xsp-request:parameter-values">
+ <xsl:call-template name="copy"/>
+ </xsl:template>
+
+ <xsl:template match="textarea/xsp-request:parameter-names">
+ <xsl:call-template name="copy"/>
+ </xsl:template>
+
+ <xsl:template match="textarea/xsp-request:headers">
+ <xsl:call-template name="copy"/>
+ </xsl:template>
+
+ <xsl:template match="textarea/xsp-request:header">
+ <xsl:call-template name="copy"/>
+ </xsl:template>
+
+ <xsl:template match="textarea/xsp-request:header-names">
+ <xsl:call-template name="copy"/>
+ </xsl:template>
+
+ <xsl:template match="@*|node()" priority="-1" name="copy">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/dynamic-page2html.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/filter-blocks.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/filter-blocks.xsl?view=auto&rev=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/filter-blocks.xsl (added)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/filter-blocks.xsl Mon May 14 23:40:14 2007
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<!--+
+ | Generate a samples page by combining the aggregated xsamples files
+ | with the gump descriptor and a list of blocks to include in the page.
+ |
+ | CVS $Id: gump2samples.xsl 36239 2004-08-11 18:28:06Z vgritsenko $
+ +-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:param name="currentPage"/>
+
+ <xsl:variable name="page" select="root/pages/samples-pages/page[@name=$currentPage]"/>
+ <xsl:variable name="xsamples" select="root/xsamples/xsamples"/>
+ <xsl:variable name="gump" select="root/gump/module"/>
+
+ <xsl:template match="/">
+ <samples name="{normalize-space($page/title)}" add-view-links="false">
+ <xsl:copy-of select="$page/links"/>
+ <!-- select either all samples or those which are selected in the current page -->
+ <xsl:choose>
+ <xsl:when test="$page/@filter-blocks='true'">
+ <xsl:for-each select="$page/blocks/block">
+ <xsl:variable name="currentBlock" select="concat('cocoon-block-',@name)"/>
+ <xsl:apply-templates select="$xsamples/sample[@name=$currentBlock]"/>
+ </xsl:for-each>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:apply-templates select="$xsamples/sample">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ <xsl:call-template name="inactive-blocks"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </samples>
+ </xsl:template>
+
+ <xsl:template match="sample">
+ <xsl:apply-templates select="xsamples/*" mode="copy"/>
+ </xsl:template>
+
+ <xsl:template match="*" mode="copy">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="copy"/>
+ <xsl:apply-templates select="." mode="hook"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="*" mode="hook"/>
+
+ <!-- add block name and status to sample -->
+ <xsl:template match="sample" mode="hook">
+ <xsl:variable name="gumpBlockName" select="ancestor::sample[1]/@name"/>
+ <xsl:variable name="gumpInfo" select="$gump/project[@name=$gumpBlockName]"/>
+ <p class="samplesStatusNote">
+ block: <b><xsl:value-of select="ancestor::sample[1]/@block-name"/></b>
+ ,
+ status: <b><xsl:value-of select="$gumpInfo/@status"/></b>
+ </p>
+ </xsl:template>
+
+ <!-- if outputting all blocks, indicate which are not active -->
+ <xsl:template name="inactive-blocks">
+ <additional-info title="Blocks without samples">
+ Here is the list of blocks which have not been included in the build or which do not
+ have samples (i.e. do not have an .xsamples file):
+ <br/>
+ <em>
+ <xsl:for-each select="$gump/project[starts-with(@name,'cocoon-block')]">
+ <xsl:sort select="@name"/>
+ <xsl:variable name="blockName" select="@name"/>
+ <xsl:if test="not($xsamples/sample[@name=$blockName])">
+ <xsl:value-of select="concat(substring-after(@name,'cocoon-block-'),' ')"/>
+ </xsl:if>
+ </xsl:for-each>
+ </em>
+ </additional-info>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/blocks/filter-blocks.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-page2html.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-page2html.xsl?view=diff&rev=538070&r1=538069&r2=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-page2html.xsl (original)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-page2html.xsl Mon May 14 23:40:14 2007
@@ -18,7 +18,7 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:param name="contextPath"/>
+ <xsl:param name="contextPath">servlet:/</xsl:param>
<xsl:param name="servletPath" select="string('/samples')"/>
<xsl:param name="sitemapURI"/>
@@ -30,7 +30,7 @@
<html>
<head>
<title><xsl:value-of select="title"/></title>
- <link rel="stylesheet" href="{$contextPath}/styles/main.css" title="Default Style"/>
+ <link rel="stylesheet" href="servlet:/styles/main.css" title="Default Style"/>
<!-- copy local CSS, if any -->
<xsl:copy-of select="style"/>
</head>
Modified: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-samples2html.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-samples2html.xsl?view=diff&rev=538070&r1=538069&r2=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-samples2html.xsl (original)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/common/style/xsl/html/simple-samples2html.xsl Mon May 14 23:40:14 2007
@@ -24,7 +24,7 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink">
- <xsl:param name="contextPath"/>
+ <xsl:param name="contextPath">servlet:/</xsl:param>
<xsl:variable name="stdLinks" select="samples/links/link[not(@role)]"/>
<xsl:variable name="seeAlsoLinks" select="samples/links/link[@role='see-also']"/>
@@ -33,13 +33,13 @@
<head>
<title>Apache Cocoon @version@</title>
<link rel="SHORTCUT ICON" href="favicon.ico"/>
- <link href="{$contextPath}/styles/main.css" type="text/css" rel="stylesheet"/>
+ <link href="servlet:/styles/main.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<table border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
<tr>
<td width="*">The Apache Software Foundation is proud to present...</td>
- <td width="40%" align="center"><img border="0" src="{$contextPath}/images/cocoon.gif"/></td>
+ <td width="40%" align="center"><img border="0" src="servlet:/images/cocoon.gif"/></td>
<td width="30%" align="center">Version: <b>@version@</b></td>
</tr>
</table>
Added: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/xsl/html/simple-samples2html.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/xsl/html/simple-samples2html.xsl?view=auto&rev=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/xsl/html/simple-samples2html.xsl (added)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/xsl/html/simple-samples2html.xsl Mon May 14 23:40:14 2007
@@ -0,0 +1,225 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<!--+
+ | Covert samples file to the HTML page. Uses styles/main.css stylesheet.
+ |
+ | $Id: simple-samples2html.xsl 448464 2006-09-21 05:29:11Z crossley $
+ +-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <xsl:param name="contextPath"/>
+ <xsl:variable name="stdLinks" select="samples/links/link[not(@role)]"/>
+ <xsl:variable name="seeAlsoLinks" select="samples/links/link[@role='see-also']"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <title>Apache Cocoon @version@</title>
+ <link rel="SHORTCUT ICON" href="favicon.ico"/>
+ <link href="{$contextPath}/styles/main.css" type="text/css" rel="stylesheet"/>
+ </head>
+ <body>
+ <table border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
+ <tr>
+ <td width="*">The Apache Software Foundation is proud to present...</td>
+ <td width="40%" align="center"><img border="0" src="{$contextPath}/images/cocoon.gif"/></td>
+ <td width="30%" align="center">Version: <b>@version@</b></td>
+ </tr>
+ </table>
+
+ <table border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
+ <tr>
+ <td width="75%">
+ <h2><xsl:value-of select="samples/@name"/></h2>
+ <xsl:if test="$seeAlsoLinks">
+ <div class="seeAlsoLinks">
+ <b>See also:</b> <xsl:apply-templates select="$seeAlsoLinks"/>
+ </div>
+ </xsl:if>
+ </td>
+ <td nowrap="nowrap" align="right">
+ <xsl:apply-templates select="$stdLinks"/>
+ <xsl:if test="not(samples/@add-view-links='false')">
+ Orthogonal views:
+ <a href="?cocoon-view=content">Content</a>
+  
+ <a href="?cocoon-view=pretty-content">Pretty content</a>
+  
+ <a href="?cocoon-view=links">Links</a>
+ </xsl:if>
+ </td>
+ </tr>
+ </table>
+
+ <xsl:apply-templates select="samples"/>
+ <xsl:apply-templates select="samples/additional-info"/>
+
+ <p class="copyright">
+ Copyright © @year@ <a href="http://www.apache.org/">The Apache Software Foundation</a>.
+ All rights reserved.
+ </p>
+ </body>
+ </html>
+ </xsl:template>
+
+
+ <xsl:template match="samples">
+ <xsl:variable name="gc" select="4"/><!-- group correction -->
+ <xsl:variable name="all-groups" select="$gc * count(group)"/>
+ <xsl:variable name="all-samples" select="count(group/sample)+count(group/note)+$all-groups"/>
+ <xsl:variable name="half-samples" select="round($all-samples div 2)"/>
+ <xsl:variable name="half-possibilities">
+ <xsl:choose>
+ <xsl:when test="count(group) = 1">1 </xsl:when><!-- single group sample.xml -->
+ <xsl:otherwise>
+ <xsl:for-each select="group">
+ <xsl:if test="position() < last() and position() >= 1">
+ <xsl:variable name="group-position" select="position()"/>
+ <xsl:variable name="prev-sample" select="count(../group[position() <= $group-position - 1]/sample) + count(../group[position() <= $group-position - 1]/note) + position() * $gc - $gc"/>
+ <xsl:variable name="curr-sample" select="count(../group[position() <= $group-position]/sample) + count(../group[position() <= $group-position]/note) + position() * $gc"/>
+ <xsl:variable name="next-sample" select="count(../group[position() <= $group-position + 1]/sample) + count(../group[position() <= $group-position + 1]/note) + position() * $gc + $gc"/>
+ <xsl:variable name="prev-deviation">
+ <xsl:choose>
+ <xsl:when test="$prev-sample > $half-samples">
+ <xsl:value-of select="$prev-sample - $half-samples"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$half-samples - $prev-sample"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="curr-deviation">
+ <xsl:choose>
+ <xsl:when test="$curr-sample > $half-samples">
+ <xsl:value-of select="$curr-sample - $half-samples"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$half-samples - $curr-sample"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="next-deviation">
+ <xsl:choose>
+ <xsl:when test="$next-sample > $half-samples">
+ <xsl:value-of select="$next-sample - $half-samples"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$half-samples - $next-sample"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$prev-deviation >= $curr-deviation and $curr-deviation <= $next-deviation">
+ <xsl:value-of select="$group-position"/><xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="half">
+ <xsl:value-of select="substring-before($half-possibilities, ' ')"/>
+ </xsl:variable>
+
+ <table width="100%" cellspacing="5">
+ <tr>
+ <td width="50%" valign="top">
+ <xsl:for-each select="group">
+ <xsl:variable name="group-position" select="position()"/>
+ <xsl:choose>
+ <xsl:when test="$group-position <= $half">
+ <h4 class="samplesGroup"><xsl:value-of select="@name"/></h4>
+ <p class="samplesText"><xsl:apply-templates/></p>
+ </xsl:when>
+ <xsl:otherwise></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </td>
+ <td valign="top">
+ <xsl:for-each select="group"> <!-- [position()<=$half] -->
+ <xsl:variable name="group-position" select="position()"/>
+ <xsl:choose>
+ <xsl:when test="$group-position > $half">
+ <h4 class="samplesGroup"><xsl:value-of select="@name"/></h4>
+ <p class="samplesText"><xsl:apply-templates/></p>
+ </xsl:when>
+ <xsl:otherwise></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template match="sample">
+ <xsl:variable name="link">
+ <xsl:choose>
+ <xsl:when test="starts-with(@href,'/')">
+ <xsl:value-of select="concat($contextPath, @href)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="string-length($link) > 0">
+ <a href="{$link}"><xsl:value-of select="@name"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> - </xsl:text>
+ <xsl:copy-of select="*|text()"/>
+ <br/>
+ </xsl:template>
+
+
+ <xsl:template match="note">
+ <p class="samplesNote">
+ <xsl:apply-templates/>
+ </p>
+ </xsl:template>
+
+
+ <xsl:template match="@*|node()" priority="-2">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="text()" priority="-1">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <xsl:template match="links/link">
+ <a href="{@href}">
+ <xsl:value-of select="."/>
+ </a>
+ </xsl:template>
+
+ <xsl:template match="additional-info">
+ <h4><xsl:value-of select="@title"/></h4>
+ <xsl:copy-of select="node()"/>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/resources/samples/common/style/xsl/html/simple-samples2html.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=538070&r1=538069&r2=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/sitemap.xmap Mon May 14 23:40:14 2007
@@ -19,17 +19,25 @@
<map:pipelines>
<map:pipeline>
+ <map:match pattern="**.cssX">
+ <map:read type="servletLinkRewriter" src="resources/{1}.css"/>
+ </map:match>
<map:match pattern="**.css">
<map:read src="resources/{1}.css"/>
</map:match>
<map:match pattern="**.js">
- <map:read src="resources/{1}.js"/>
+ <map:read type="servletLinkRewriter" src="resources/{1}.js"/>
+ </map:match>
+ <map:match pattern="**.gif">
+ <map:read src="resources/{1}.gif"/>
+ </map:match>
+ <map:match pattern="**.ico">
+ <map:read src="resources/{1}.ico"/>
</map:match>
</map:pipeline>
<map:pipeline>
<map:match pattern="**">
- <map:generate src="{1}"/>
- <map:serialize type="xml"/>
+ <map:read type="servletLinkRewriter" src="{1}"/>
</map:match>
</map:pipeline>
</map:pipelines>
Modified: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/stylesheets/system/xml2html.xslt
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/stylesheets/system/xml2html.xslt?view=diff&rev=538070&r1=538069&r2=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/stylesheets/system/xml2html.xslt (original)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/COB-INF/stylesheets/system/xml2html.xslt Mon May 14 23:40:14 2007
@@ -32,8 +32,8 @@
<xsl:template match="/">
<HTML>
<HEAD>
- <link href="/styles/prettycontent.css" type="text/css" rel="stylesheet"/>
- <script src="/scripts/prettycontent.js" type="text/javascript"/>
+ <link href="servlet:/styles/prettycontent.css" type="text/css" rel="stylesheet"/>
+ <script src="servlet:/scripts/prettycontent.js" type="text/javascript"/>
</HEAD>
<BODY>
<xsl:apply-templates/>
Added: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/META-INF/cocoon/spring/cocoon-samples-style-default-blockServlet.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/META-INF/cocoon/spring/cocoon-samples-style-default-blockServlet.xml?view=auto&rev=538070
==============================================================================
--- cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/META-INF/cocoon/spring/cocoon-samples-style-default-blockServlet.xml (added)
+++ cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/META-INF/cocoon/spring/cocoon-samples-style-default-blockServlet.xml Mon May 14 23:40:14 2007
@@ -0,0 +1,29 @@
+<?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.
+-->
+
+<!-- @version $Id: cocoon-core-main-sample-blockServlet.xml 503414 2007-02-04 14:37:20Z danielf $ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:servlet="http://cocoon.apache.org/schema/servlet"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cocoon.apache.org/schema/servlet http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd">
+
+ <bean id="org.apache.cocoon.samples.style.default.servlet" class="org.apache.cocoon.sitemap.SitemapServlet">
+ <servlet:context mount-path="/cocoon-samples-style-default" context-path="blockcontext:/cocoon-samples-style-default/"/>
+ </bean>
+</beans>
Propchange: cocoon/trunk/blocks/cocoon-samples-style/cocoon-samples-style-default/src/main/resources/META-INF/cocoon/spring/cocoon-samples-style-default-blockServlet.xml
------------------------------------------------------------------------------
svn:eol-style = native