haul 2002/06/25 02:37:05
Modified: src/documentation/xdocs/userdocs/concepts modules.xml
Log:
Add new sitemap syntax, thanks to Sylvain.
Revision Changes Path
1.2 +51 -12
xml-cocoon2/src/documentation/xdocs/userdocs/concepts/modules.xml
Index: modules.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/documentation/xdocs/userdocs/concepts/modules.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- modules.xml 28 Apr 2002 18:11:12 -0000 1.1
+++ modules.xml 25 Jun 2002 09:37:05 -0000 1.2
@@ -80,7 +80,7 @@
<s2 title="Step 1: Making a new module know to Apache Cocoon">
<p>
Like other core components of Apache Cocoon, modules are declared in
- <code>cocoon.xconf</code>.
+ <code>cocoon.xconf</code>. There are already too many to list here.
</p>
<source>
<![CDATA[
@@ -90,6 +90,14 @@
<component-instance name="URI"
class="org.apache.cocoon.components.modules.input.RequestURIModule"/>
<component-instance name="header"
class="org.apache.cocoon.components.modules.input.HeaderAttributeModule"/>
<component-instance name="session"
class="org.apache.cocoon.components.modules.input.SessionAttributeModule"/>
+ <component-instance name="date"
class="org.apache.cocoon.components.modules.input.DateInputModule"/>
+ <component-instance name="defaults"
class="org.apache.cocoon.components.modules.input.DefaultsMetaModule">
+ <input-module name="request"/>
+ <values>
+ <skin>defaultSkin</skin>
+ <base-url>http://localhost:8080/cocoon</base-url>
+ </values>
+ </component-instance>
</input-modules>
<output-modules>
@@ -121,13 +129,43 @@
which one to use.
</p>
</s2>
- <s2 title="Step 2: Have sitemap component use a module">
+ <s2 title="Step 2: Use it">
<p>
- This depends on the component that is to be used. As an example the
- <code>CachingWildcardMatcher</code> requires to set the
- <code>input-module</code> on declaration.
+ Two alternatives for using modules exist:
</p>
- <source>
+ <s3 title="Step 2a: Use it as sitemap variable">
+ <p>
+ Input modules can be used in a sitemap almost like a sitemap
+ variable. If the variable name contains a colon (":"), the
+ preceeding string is used as the name of the module to use and
the
+ trailing string is passed to the module. The expression is
replaced
+ with the string value returned from the module.
+ </p>
+ <source>
+<![CDATA[
+ <map:transform src="resources/stylesheets/{../skin}.xsl"/>
+]]>
+ </source>
+ <p>
+ The above example uses the variable <code>skin</code> declared
+ e.g. by an action for the stylesheet to apply to the page. The
+ example below uses an input module instead. The way this
module was
+ declared above allows to override the skin with a request
parameter
+ named "skin".
+ </p>
+ <source>
+<![CDATA[
+ <map:transform src="resources/stylesheets/{default:skin}.xsl"/>
+]]>
+ </source>
+ </s3>
+ <s3 title="Step 2b: Have sitemap components use a module">
+ <p>
+ This depends on the component that is to be used. As an
example the
+ <code>CachingWildcardMatcher</code> requires to set the
+ <code>input-module</code> on declaration.
+ </p>
+ <source>
<![CDATA[
<map:matchers default="wildcard">
<map:matcher name="cached-uri"
src="org.apache.cocoon.matching.modular.CachingWildcardMatcher">
@@ -135,12 +173,13 @@
</map:matcher>
</map:matchers>
]]>
- </source>
- <p>
- By replacing the input module name with any of the other declared
- input modules, this matcher can be used to match e.g. on session
- attributes or request headers.
- </p>
+ </source>
+ <p>
+ By replacing the input module name with any of the other
declared
+ input modules, this matcher can be used to match e.g. on
session
+ attributes, request headers or even dates!
+ </p>
+ </s3>
</s2>
</s1>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]