You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by kp...@apache.org on 2002/09/21 00:56:37 UTC
cvs commit: xml-cocoon2/src/webapp/samples/modules/images chapter.gif chapter_open.gif current.gif page.gif
kpiroumian 2002/09/20 15:56:37
Added: src/webapp/samples/modules index.xhtml menu.xml
menu2html.xsl page.css properties.xsp
properties2html.xsl site2html.xsl sitemap.xmap
src/webapp/samples/modules/images chapter.gif
chapter_open.gif current.gif page.gif
Log:
Input modules sample.
Revision Changes Path
1.1 xml-cocoon2/src/webapp/samples/modules/index.xhtml
Index: index.xhtml
===================================================================
<page>
<title>Index</title>
<table>
<tr>
<td>
<h3>Input Modules</h3>
<p>Modules are used to access input and output data in
modular way.
</p>
<table class="table">
<tr>
<th>Input module</th>
<th>Description</th>
</tr>
<tr>
<td><a href="request.xsp">request</a></td>
<td>Request object properties</td>
</tr>
<tr>
<td><a href="session.xsp">session</a></td>
<td>Session object properties</td>
</tr>
<tr>
<td><a href="request-param.xsp">request-param</a></td>
<td>Request parameters</td>
</tr>
<tr>
<td><a href="request-attr.xsp">request-attr</a></td>
<td>Request attributes</td>
</tr>
</table>
</td>
</tr>
</table>
</page>
1.1 xml-cocoon2/src/webapp/samples/modules/menu.xml
Index: menu.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "dtd/book-cocoon-v10.dtd" -->
<book software="Apache Cocoon"
title="Apache Cocoon i18n Samples"
copyright="1999-2002 The Apache Software Foundation"
>
<menu label="Overview">
<menu-item label="Index" href="index.xsp"/>
<menu-item label="Sitemap" href="sitemap.xmap"/>
</menu>
<menu label="Modules">
<menu-item label="RequestModule" href="request.xsp"/>
<menu-item label="SessionModule" href="session.xsp"/>
<menu-item label="AttributeModule" />
</menu>
<menu label="Documentation">
<external label="Input Modules Docs" href="../../documents/userdocs/concepts/modules.html"/>
<external label="API Docs" href="../../documents/apidocs/org/apache/cocoon/components/modules/input/package-summary.html"/>
</menu>
<menu label="Credits">
<menu-item label="Christian Haul" href="mailto:haul@apache.org"/>
<menu-item label="Konstantin Piroumian" href="mailto:kpiroumian@apache.org"/>
<menu-item label="Many others..." href="http://xml.apache.org/cocoon/who.html"/>
</menu>
</book>
1.1 xml-cocoon2/src/webapp/samples/modules/menu2html.xsl
Index: menu2html.xsl
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="page" />
<xsl:template match="book">
<table class="menu">
<tr>
<td>
<ul>
<xsl:apply-templates select="menu"/>
</ul>
</td>
</tr>
</table>
</xsl:template>
<!-- Process only current book -->
<xsl:template match="book[@current]">
<ul>
<xsl:apply-templates />
</ul>
</xsl:template>
<!-- Current (open) menu -->
<xsl:template match="menu">
<li>
<xsl:if test="@icon">
<img src="{@icon}" align="middle"/><xsl:text> </xsl:text>
</xsl:if>
<span class="chapter open"><xsl:value-of select="@label" /></span>
</li>
<ul>
<xsl:apply-templates />
</ul>
</xsl:template>
<!-- Display a link to a page -->
<xsl:template match="menu-item[@href=$page]">
<li class="current" title="{@href}">
<xsl:if test="@icon">
<img src="{@icon}" align="middle"/><xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="@label" />
</li>
</xsl:template>
<xsl:template match="menu-item | external">
<li class="page">
<xsl:if test="@icon">
<img src="{@icon}" align="middle"/><xsl:text> </xsl:text>
</xsl:if>
<a href="{@href}" class="page"><xsl:value-of select="@label" /></a>
</li>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon2/src/webapp/samples/modules/page.css
Index: page.css
===================================================================
body { background-color: #FFFFFF; margin: 0px 0px 0px 0px; font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif}
form { margin: 0px; padding: 0px; border: 0px; }
ul,ol { margin: 10px 5px 10px 40px; padding: 0px; }
li { margin: 2px 0px 2px 0px; }
dl { margin: 10px 5px 10px 20px; padding: 0px; }
dt { font-weight: bold; margin: 5px 0px 0px 0px; }
table { border: 0px; width: 100%; }
td { font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif }
img { border: 0px; }
pre { padding: 10px 10px 10px 10px; margin-bottom: 0px }
a:link { color: #0F3660 }
a:visited { color: #880000 }
a:active { }
a:hover { color: #880000; }
.path { font-size: 10px; background-color: #CFDCED; border-bottom-color: #4A6D8C; border-bottom-style: solid; border-bottom-width: 2px; padding: 2px; }
.path .current { font-weight: bold; }
.top { background-color: #294563; }
.top img { margin: 5px; }
.topline { background-color: #4C6C8F; }
.navbar { background-color: #CFDCED; color: #4C6C8F; font-weight: bold; border-bottom-color: #4A6D8C; border-bottom-style: solid; border-bottom-width: 1px; padding: 2px;}
.search { font-size: 13px; color: #ffffff; margin-right: 10px; padding: 10px 5px 3px 5px; background-color: #4A6D8C; }
.tabs { font-size: 12px; background-color: #294563; padding: 2px 7px 5px 7px; }
.tabs .tab { background-color: #CFDCED; padding: 4px 6px 4px 6px;}
.tabs .current { background-color: #4C6C8F; font-weight: bold; padding: 5px 6px 6px 6px; ; color: #FFFFFF}
.copyright { text-align: center; font-size: 10px; background-color: #CFDCED; border-top-color: #4A6D8C; border-top-style: solid; border-top-width: 1px; padding: 2px; }
.menu { background-color: #4C6C8F; margin: 0px; padding: 3px 8px 5px 3px; color: #FFFFFF}
.menu a:link { color: #FFFFFF }
.menu a:visited { color: #FFFFFF }
.menu a:active { }
.menu a:hover { color: #880000; }
.menu ul { margin: 0px 0px 0px 20px; padding: 0px; }
.menu li .chapter { list-style-image: url('images/chapter.gif'); font-weight: bold }
.menu li .open { list-style-image: url('images/chapter_open.gif'); font-weight: bold }
.menu li .page { list-style-image: url('images/page.gif') }
.menu li .current { list-style-image: url('images/current.gif'); color: #FFD700; font-weight: bold; }
.content { padding: 5px 5px 5px 10px; }
.frame { width: 100%; margin: 5px 20px 5px 20px; font-size: 11px; }
.frame .content { margin: 0px; }
.note { border: solid 1px #7099C5; background-color: #f0f0ff; }
.note .label { background-color: #7099C5; color: #ffffff; }
.warning { border: solid 1px #D00000; background-color: #fff0f0; }
.warning .label { background-color: #D00000; color: #ffffff; }
.fixme { border: solid 1px #C6C600; background-color: #FAF9C3; }
.fixme .label { background-color: #C6C600; color: #ffffff; }
.code { border-color: #CFDCED; border-style: solid; border-width: 1px; }
table.table { width: 100%; font-size: 11px; background-color: #7099C5; color: #ffffff; }
.table caption { text-align: left; text-weight: bold; color: black; }
.table th { text-align: center; text-weight: bold; }
.table td { background-color: #f0f0ff; color: black; }
.dida { font-size: 9px; }
.figure {}
.icon {}
.highlight { background-color: yellow; }
1.1 xml-cocoon2/src/webapp/samples/modules/properties.xsp
Index: properties.xsp
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: properties.xsp,v 1.1 2002/09/20 22:56:36 kpiroumian Exp $ -->
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
<properties>
<xsp:logic>
try {
String[] paramNames = parameters.getNames();
for (int i = 0; i < paramNames.length; i++) {
String paramName = paramNames[i];
<xsp:content>
<property>
<name><xsp:expr>paramName</xsp:expr></name>
<value><xsp:expr>parameters.getParameter(paramName)</xsp:expr></value>
</property>
</xsp:content>
}
} catch (org.apache.avalon.framework.parameters.ParameterException pe) {
throw new ProcessingException("Parameter error.", pe);
}
</xsp:logic>
</properties>
</xsp:page>
1.1 xml-cocoon2/src/webapp/samples/modules/properties2html.xsl
Index: properties2html.xsl
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="title">Input Module</xsl:param>
<xsl:template match="/">
<page>
<title><xsl:value-of select="$title"/></title>
<table class="content">
<tr>
<td>
<h3><xsl:value-of select="$title"/></h3>
<xsl:apply-templates />
</td>
</tr>
</table>
</page>
</xsl:template>
<xsl:template match="properties">
<table class="table">
<tr>
<th>Accessor</th>
<th>Value</th>
</tr>
<xsl:apply-templates>
<xsl:sort select="name" />
</xsl:apply-templates>
</table>
</xsl:template>
<xsl:template match="property">
<tr>
<td><xsl:value-of select="name"/></td>
<td>
<xsl:value-of select="value"/> 
</td>
</tr>
</xsl:template>
<xsl:template match="title"></xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon2/src/webapp/samples/modules/site2html.xsl
Index: site2html.xsl
===================================================================
<?xml version="1.0"?>
<!DOCTYPE html [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY laquo "«">
<!ENTITY raquo "»">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="page" />
<xsl:template match="site">
<html>
<head>
<title>
<xsl:value-of select="page/title" />
</title>
<link rel="stylesheet" href="page.css" type="text/css"/>
</head>
<body>
<table class="path">
<tr>
<td>
<a href="../../">Apache Cocoon Main</a> > <a href="../">Samples</a> > <a href="./">Modules</a> > <span class="current"><xsl:value-of select="page/title"/></span>
</td>
</tr>
</table>
<table class="topline"><tr><td> </td></tr></table>
<table cellspacing="0" cellpadding="0" summary="content pane">
<tr>
<td width="5" class="navbar"> </td>
<td rowspan="2" valign="top" nowrap="nowrap" width="200">
<xsl:apply-templates select="table[@class='menu']"/>
</td>
<td valign="top" class="navbar" align="left">
 
</td>
<td width="*" valign="top" class="navbar" align="right">
Page: <xsl:value-of select="$page" />
</td>
</tr>
<tr>
<td> </td>
<td class="content" valign="top" colspan="2">
<xsl:apply-templates select="page"/>
</td>
</tr>
</table>
<table>
<tr>
<td class="copyright">
Copyright (c) 1999-2002 <a href="http://www.apache.org/">Apache Software Foundation</a>. All Rights Reserved.
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="node()|@*" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon2/src/webapp/samples/modules/sitemap.xmap
Index: sitemap.xmap
===================================================================
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<!-- $Id: sitemap.xmap,v 1.1 2002/09/20 22:56:36 kpiroumian Exp $ -->
<!--
Input Modules sample sitemap.
Author: Konstantin Piroumian "kpiroumian@apache.org"
-->
<!-- =========================== Resources =============================== -->
<map:resources>
<!-- This resource is used to create a composite page from menu and content -->
<map:resource name="composite">
<map:aggregate element="site">
<map:part src="cocoon:/menu/{../0}"/>
<map:part src="cocoon:/content/{../0}" label="content"/>
</map:aggregate>
<map:transform src="site2html.xsl">
<map:parameter name="page" value="{../0}" />
</map:transform>
<map:serialize/>
</map:resource>
</map:resources>
<!-- =========================== Pipelines ================================= -->
<map:pipelines>
<map:pipeline>
<!-- Default URL matcher. Matches '/' URLs-->
<map:match pattern="">
<map:redirect-to uri="index.xsp" />
</map:match>
<!-- Generate dynamic output (simple.xsp) -->
<map:match pattern="*.xsp">
<map:call resource="composite" />
</map:match>
<map:match pattern="content/index.xsp">
<map:generate src="index.xhtml"/>
<map:serialize/>
</map:match>
<map:match pattern="content/request.xsp">
<map:generate type="serverpages" src="properties.xsp">
<map:parameter name="attribute-names" value="{request:attributeNames}"/>
<map:parameter name="auth-type" value="{request:authType}"/>
<map:parameter name="character-encoding" value="{request:characterEncoding}"/>
<map:parameter name="cookie-map" value="{request:cookieMap}"/>
<map:parameter name="cookies" value="{request:cookies}"/>
<map:parameter name="content-length" value="{request:contentLength}"/>
<map:parameter name="content-type" value="{request:contentType}"/>
<map:parameter name="context-path" value="{request:contextPath}"/>
<map:parameter name="headers" value="{request:headers}"/>
<map:parameter name="header-names" value="{request:header-names}"/>
<map:parameter name="locale" value="{request:locale}"/>
<map:parameter name="locales" value="{request:locales}"/>
<map:parameter name="method" value="{request:method}"/>
<!--map:parameter name="parameter-map" value="{request:parameterMap}"/-->
<map:parameter name="parameter-names" value="{request:parameterNames}"/>
<map:parameter name="path-info" value="{request:pathInfo}"/>
<map:parameter name="path-translated" value="{request:pathTranslated}"/>
<map:parameter name="protocol" value="{request:protocol}"/>
<map:parameter name="query-string" value="{request:queryString}"/>
<map:parameter name="remote-addr" value="{request:remoteAddr}"/>
<map:parameter name="remote-host" value="{request:remoteHost}"/>
<map:parameter name="remote-user" value="{request:remoteUser}"/>
<map:parameter name="request-uri" value="{request:requestURI}"/>
<map:parameter name="requested-session-id" value="{request:requestedSessionId}"/>
<map:parameter name="requested-session-id-from-cookie" value="{request:requestedSessionIdFromCookie}"/>
<map:parameter name="requested-session-id-from-url" value="{request:requestedSessionIdFromURL}"/>
<map:parameter name="requested-session-id-valid" value="{request:requestedSessionIdValid}"/>
<map:parameter name="scheme" value="{request:scheme}"/>
<map:parameter name="secure" value="{request:secure}"/>
<map:parameter name="server-name" value="{request:serverName}"/>
<map:parameter name="server-port" value="{request:serverPort}"/>
<map:parameter name="servlet-path" value="{request:servletPath}"/>
<map:parameter name="session [truncated]" value="{request:concat('org. ... .', substring(session, 36))}"/>
<map:parameter name="sitemap-uri" value="{request:sitemapURI}"/>
<map:parameter name="user-principal" value="{request:userPrincipal}"/>
</map:generate>
<map:transform src="properties2html.xsl">
<map:parameter name="title" value="Request Input Module (RequestModule)"/>
</map:transform>
<map:serialize />
</map:match>
<map:match pattern="content/session.xsp">
<map:generate type="serverpages" src="properties.xsp">
<map:parameter name="attribute-names" value="{session:attributeNames}"/>
<map:parameter name="creation-time" value="{session:creationTime}"/>
<map:parameter name="last-accessed-time" value="{session:lastAccessedTime}"/>
<map:parameter name="max-inactive-interval" value="{session:maxInactiveInterval}"/>
<map:parameter name="id" value="{session:id}"/>
<map:parameter name="new" value="{session:new}"/>
</map:generate>
<map:transform src="properties2html.xsl">
<map:parameter name="title" value="Session Input Module (SessionModule)"/>
</map:transform>
<map:serialize />
</map:match>
<!-- Menu generation -->
<map:match pattern="menu/*">
<map:generate src="menu.xml"/>
<map:transform src="menu2html.xsl">
<map:parameter name="page" value="{1}" />
</map:transform>
<map:serialize/>
</map:match>
<!-- Display this sitemap source-->
<map:match pattern="sitemap.xmap">
<map:generate src="sitemap.xmap"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="*.css">
<map:read src="{1}.css" mime-type="text/css"/>
</map:match>
<map:match pattern="images/*.gif">
<map:read src="images/{1}.gif" mime-type="image/gif"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
<!-- end of file -->
1.1 xml-cocoon2/src/webapp/samples/modules/images/chapter.gif
<<Binary file>>
1.1 xml-cocoon2/src/webapp/samples/modules/images/chapter_open.gif
<<Binary file>>
1.1 xml-cocoon2/src/webapp/samples/modules/images/current.gif
<<Binary file>>
1.1 xml-cocoon2/src/webapp/samples/modules/images/page.gif
<<Binary file>>
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org