blob: 421d8186290cb648524caf586141cbe7f11a12be [file] [log] [blame]
<?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.
-->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:transformers default="xslt">
<!--+
| This transformer is used to extract the form instance data from the
| xml document. See the javadocs of this class for more information on
| the default configuration and configuration options.
|
| Here, the instance data is nested inside the form element. The
| transformer can be configured to look for it at other places.
|
| The instance data is stored as an attribute with the same name as the
| form using an output module. Here we decide to use the RequestAttributeMap
| module. This allows
| a) to store instances for several forms and
| b) to access a particular instance and value using JXPath syntax.
|
| Per default, the map key is the name of the form as is the root node
| of the new Document.
|
+-->
<map:transformer name="simpleform-instance-extraction"
logger="sitemap.transformer.simpleform-request"
src="org.apache.cocoon.transformation.SimpleFormInstanceExtractionTransformer">
<output name="request-attr-map"/>
</map:transformer>
<!--+
| This is the other transformer to read and insert the instance data.
| It will be applied first in the pipeline so that the user submitted
| data can override the default data.
|
| Only one of the two transformers needs to check for validation errors,
| this instance has been instructed to ignore validation results because
| looking up the instance data requires to augment the element name with
| the form name and thus differ from the validation result names.
|
| The instance extractor places the form instances into a map with the
| form name as key. Furthermore, it has been instructed to create a root
| element wrapping the instance data with the same name as the form.
| Hence we need to included the form's name twice in the element name
| used for the lookup.
|
| In addition, we may want to be able to select from a XSP if the form
| data should be replaced with values from the instance or from the
| request. Therefore, a different attribute is used to protect element
| values.
|
+-->
<map:transformer name="simpleform-instance"
logger="sitemap.transformer.simpleform-instance"
src="org.apache.cocoon.transformation.SimpleFormTransformer">
<fixed-attribute>this-is-never-used</fixed-attribute>
<use-form-name-twice>true</use-form-name-twice>
<ignore-validation>true</ignore-validation>
<input-module name="jxpath">
<!--+
| "jxpath" does not pass the attribute name to the module it
| obtains the value to act from. Thus an additional attribute
| name needs to be injected.
+-->
<from-parameter>org.apache.cocoon.components.modules.output.OutputModule</from-parameter>
<input-module name="request-attr"/>
</input-module>
</map:transformer>
</map:transformers>
</map:components>
<!--+
| This is a standard resource for rendering a XSP page.
+-->
<map:resources>
<map:resource name="static-page">
<map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
<map:parameter name="servletPath" value="{request:servletPath}"/>
<map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
<map:parameter name="contextPath" value="{request:contextPath}"/>
<map:parameter name="remove" value="{/0}"/>
<map:parameter name="file" value="{file}.xml"/>
</map:transform>
<map:serialize/>
</map:resource>
</map:resources>
<!--+
| These views provide different 'standard' views to the samples.
+-->
<map:views>
<map:view name="content" from-label="content">
<map:serialize type="xml"/>
</map:view>
<map:view from-label="content" name="pretty-content">
<map:transform src="context://stylesheets/system/xml2html.xslt"/>
<map:serialize type="html"/>
</map:view>
<map:view name="links" from-position="last">
<map:serialize type="links"/>
</map:view>
</map:views>
<!--+
| Pipelines
+-->
<map:pipelines>
<map:pipeline>
<!-- some redirections -->
<map:match pattern="">
<map:redirect-to uri="index"/>
</map:match>
<map:match pattern="index">
<map:generate type="file" src="form.xml"/>
<!-- extract the instance data -->
<map:transform type="simpleform-instance-extraction"/>
<!-- fill in the instance data -->
<map:transform type="simpleform-instance"/>
<map:call resource="static-page">
<map:parameter name="file" value="form"/>
</map:call>
</map:match>
<!-- some redirections -->
<map:match pattern="*">
<map:redirect-to uri="index"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>