You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2002/07/10 21:14:51 UTC

cvs commit: xml-cocoon2/src/documentation/xdocs/userdocs/selectors parameter-selector.xml

vgritsenko    2002/07/10 12:14:51

  Modified:    src/documentation/xdocs/userdocs/selectors
                        parameter-selector.xml
  Log:
  Fix CR/LF
  
  Revision  Changes    Path
  1.2       +158 -158  xml-cocoon2/src/documentation/xdocs/userdocs/selectors/parameter-selector.xml
  
  Index: parameter-selector.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/documentation/xdocs/userdocs/selectors/parameter-selector.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- parameter-selector.xml	10 Jul 2002 18:54:33 -0000	1.1
  +++ parameter-selector.xml	10 Jul 2002 19:14:51 -0000	1.2
  @@ -1,158 +1,158 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  - <header>
  -  <title>Parameter Selector</title>
  -  <subtitle>in @doctitle@</subtitle>
  -  <version>0.9</version>
  -  <type>Technical document</type>
  -  <authors>
  -   <person name="Beth Naquin" email="beth.naquin@morpho.com"/>
  -  </authors>
  -  <abstract>This document describes the Parameter Selector.</abstract>
  - </header>
  - <body>
  -  <s1 title="Parameter Selector">
  -   
  -   <ul>
  -    <li>Name : ParameterSelector</li>
  -    <li>Class: org.apache.cocoon.selection.ParameterSelector</li>
  -    <li>Cacheable: not applicable</li>
  -   </ul>
  -   
  -   <p>
  -    This Selector matches a string, in the Parameters object passed to the 
  -    selector, against a specified Cocoon internal parameter.  It performs a 
  -    case-sensitive string comparison between the value of the 
  -    'parameter-selector-test' parameter and the value of the 'test' 
  -    attribute of the <code><![CDATA[<map:when ...>]]></code> element.
  -   </p>
  -   
  -   <p>
  -   This internal parameter could be:
  -   </p>
  -   <ul>
  -    <li>A sitemap parameter from the <code><![CDATA[<map:match ...>]]></code> portion of the pipeline</li>
  -    <li>A sitemap parameter set by an action</li>
  -   </ul>
  -   </s1>
  -   
  -   
  -   <s1 title="Reasons to use ParameterSelector">
  -   <p>
  -   One purpose of this selector is to choose between different components 
  -   of a pipeline based on sitemap parameters set by an action.  This would 
  -   allow the action to control the logic required to set one or more parameters, 
  -   which can then be used by this selector to control pipeline processing.  
  -   Thus, complex decision-making logic can be contained in actions, while the 
  -   sitemap simply uses the results of the actions (the parameters) to determine 
  -   pipeline processing.
  -   </p>
  -   <p>
  -   Parameter Selector can also be used to select on the value of 'keys' 
  -   (such as {1} or {../2} ) from the wildcard matcher.  Information in the 
  -   URI, such as part of a filename, can then be used to determine pipeline 
  -   processing.   
  -   </p>
  -   </s1>
  -   
  -   <s1 title="Examples">
  -   <p>
  -   Add the component to your sitemap.xmap:
  -   </p>
  -   <source><![CDATA[
  -   <map:components>
  -    ...
  -    <map:selectors>
  -     ...
  -     <map:selector
  -	    name="parameter"
  -      	logger="sitemap.selector.parameter"
  -      	src="org.apache.cocoon.selection.ParameterSelector"/>
  -     ...]]></source>
  -   
  -   <p>
  -   Use a parameter set by an action:
  -   </p>
  -   <p>
  -    Assume there is an action (named MyAction) that sets a parameter 
  -    (named MyRegion) to several possible values.  For more information on actions, 
  -    including a simple example of an action that creates a sitemap parameter, see
  -    <link href="../concepts/actions.html">Creating and Using Actions</link>.
  -   </p>
  -   <source><![CDATA[
  -   <map:match pattern="*.xml">
  -    <map:act type="MyAction">
  -      <map:generate src="{../1}.xml"/>
  -
  -      <map:select type="parameter">
  -        <map:parameter name="parameter-selector-test" value="{MyRegion}"/>
  -      
  -        <!-- executes iff the value of MyRegion equals 
  -             "United States" (without quotes) -->
  -        <map:when test="United States">
  -          <map:transform src="stylesheets/us.xsl"/>
  -        </map:when>
  -      
  -        <map:when test="South_America">
  -          <map:transform src="stylesheets/southamerica.xsl"/>
  -        </map:when>
  -
  -        <map:when test="Europe">
  -          <map:transform src="stylesheets/europe.xsl"/>
  -        </map:when>
  -
  -        <map:otherwise>
  -          <map:transform src="all_others.xsl"
  -        </map:otherwise>
  -
  -      </map:select>
  -    </map:act>
  -    <map:serialize/>
  -  </map:match>]]></source>
  -   
  -   <p>
  -   Use values from the URI:
  -   </p>
  -   <source><![CDATA[
  -   <map:pipeline>
  -     <!-- {1}/{2}/myfile.xml -->
  -     <map:match pattern="**/*/myfile.xml"> 
  -   
  -       <!-- Use ParameterSelector -->
  -       <map:select type="parameter">
  -        <map:parameter name="parameter-selector-test" value="{2}"/>
  -
  -        <!-- executes iff the value of {2} equals 
  -             "basic" (without quotes); the requested URI
  -              could be **/basic/myfile.xml -->
  -        <map:when test="basic">
  -            <map:generate src="{1}/myfile.xml"/>
  -            <map:transform src="stylesheets/basic.xsl">
  -                <map:parameter name="use-request-parameters" value="true"/>
  -                <map:parameter name="resource" value="{2}.html"/>
  -            </map:transform>
  -            <map:serialize/>
  -        </map:when>
  -
  -        <map:when test="aggregate">
  -            <map:aggregate element="site">
  -        	<map:part src="cocoon:/{1}/sidebar-{1}/{2}.xml"/>
  -        	<map:part src="cocoon:/body-{1}/{2}.xsp"/>
  -            </map:aggregate>
  -            <map:transform src="stylesheets/aggregate2xhtml.xsl"/>
  -            <map:serialize/>
  -        </map:when>
  -
  -        <map:otherwise>
  -            <map:redirect-to uri="other_URI"/>
  -        </map:otherwise>
  -
  -      </map:select>
  -    </map:match> 
  -    ...]]></source>
  -   </s1>
  -   
  - </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  + <header>
  +  <title>Parameter Selector</title>
  +  <subtitle>in @doctitle@</subtitle>
  +  <version>0.9</version>
  +  <type>Technical document</type>
  +  <authors>
  +   <person name="Beth Naquin" email="beth.naquin@morpho.com"/>
  +  </authors>
  +  <abstract>This document describes the Parameter Selector.</abstract>
  + </header>
  + <body>
  +  <s1 title="Parameter Selector">
  +   
  +   <ul>
  +    <li>Name : ParameterSelector</li>
  +    <li>Class: org.apache.cocoon.selection.ParameterSelector</li>
  +    <li>Cacheable: not applicable</li>
  +   </ul>
  +   
  +   <p>
  +    This Selector matches a string, in the Parameters object passed to the 
  +    selector, against a specified Cocoon internal parameter.  It performs a 
  +    case-sensitive string comparison between the value of the 
  +    'parameter-selector-test' parameter and the value of the 'test' 
  +    attribute of the <code><![CDATA[<map:when ...>]]></code> element.
  +   </p>
  +   
  +   <p>
  +   This internal parameter could be:
  +   </p>
  +   <ul>
  +    <li>A sitemap parameter from the <code><![CDATA[<map:match ...>]]></code> portion of the pipeline</li>
  +    <li>A sitemap parameter set by an action</li>
  +   </ul>
  +   </s1>
  +   
  +   
  +   <s1 title="Reasons to use ParameterSelector">
  +   <p>
  +   One purpose of this selector is to choose between different components 
  +   of a pipeline based on sitemap parameters set by an action.  This would 
  +   allow the action to control the logic required to set one or more parameters, 
  +   which can then be used by this selector to control pipeline processing.  
  +   Thus, complex decision-making logic can be contained in actions, while the 
  +   sitemap simply uses the results of the actions (the parameters) to determine 
  +   pipeline processing.
  +   </p>
  +   <p>
  +   Parameter Selector can also be used to select on the value of 'keys' 
  +   (such as {1} or {../2} ) from the wildcard matcher.  Information in the 
  +   URI, such as part of a filename, can then be used to determine pipeline 
  +   processing.   
  +   </p>
  +   </s1>
  +   
  +   <s1 title="Examples">
  +   <p>
  +   Add the component to your sitemap.xmap:
  +   </p>
  +   <source><![CDATA[
  +   <map:components>
  +    ...
  +    <map:selectors>
  +     ...
  +     <map:selector
  +	    name="parameter"
  +      	logger="sitemap.selector.parameter"
  +      	src="org.apache.cocoon.selection.ParameterSelector"/>
  +     ...]]></source>
  +   
  +   <p>
  +   Use a parameter set by an action:
  +   </p>
  +   <p>
  +    Assume there is an action (named MyAction) that sets a parameter 
  +    (named MyRegion) to several possible values.  For more information on actions, 
  +    including a simple example of an action that creates a sitemap parameter, see
  +    <link href="../concepts/actions.html">Creating and Using Actions</link>.
  +   </p>
  +   <source><![CDATA[
  +   <map:match pattern="*.xml">
  +    <map:act type="MyAction">
  +      <map:generate src="{../1}.xml"/>
  +
  +      <map:select type="parameter">
  +        <map:parameter name="parameter-selector-test" value="{MyRegion}"/>
  +      
  +        <!-- executes iff the value of MyRegion equals 
  +             "United States" (without quotes) -->
  +        <map:when test="United States">
  +          <map:transform src="stylesheets/us.xsl"/>
  +        </map:when>
  +      
  +        <map:when test="South_America">
  +          <map:transform src="stylesheets/southamerica.xsl"/>
  +        </map:when>
  +
  +        <map:when test="Europe">
  +          <map:transform src="stylesheets/europe.xsl"/>
  +        </map:when>
  +
  +        <map:otherwise>
  +          <map:transform src="all_others.xsl"
  +        </map:otherwise>
  +
  +      </map:select>
  +    </map:act>
  +    <map:serialize/>
  +  </map:match>]]></source>
  +   
  +   <p>
  +   Use values from the URI:
  +   </p>
  +   <source><![CDATA[
  +   <map:pipeline>
  +     <!-- {1}/{2}/myfile.xml -->
  +     <map:match pattern="**/*/myfile.xml"> 
  +   
  +       <!-- Use ParameterSelector -->
  +       <map:select type="parameter">
  +        <map:parameter name="parameter-selector-test" value="{2}"/>
  +
  +        <!-- executes iff the value of {2} equals 
  +             "basic" (without quotes); the requested URI
  +              could be **/basic/myfile.xml -->
  +        <map:when test="basic">
  +            <map:generate src="{1}/myfile.xml"/>
  +            <map:transform src="stylesheets/basic.xsl">
  +                <map:parameter name="use-request-parameters" value="true"/>
  +                <map:parameter name="resource" value="{2}.html"/>
  +            </map:transform>
  +            <map:serialize/>
  +        </map:when>
  +
  +        <map:when test="aggregate">
  +            <map:aggregate element="site">
  +        	<map:part src="cocoon:/{1}/sidebar-{1}/{2}.xml"/>
  +        	<map:part src="cocoon:/body-{1}/{2}.xsp"/>
  +            </map:aggregate>
  +            <map:transform src="stylesheets/aggregate2xhtml.xsl"/>
  +            <map:serialize/>
  +        </map:when>
  +
  +        <map:otherwise>
  +            <map:redirect-to uri="other_URI"/>
  +        </map:otherwise>
  +
  +      </map:select>
  +    </map:match> 
  +    ...]]></source>
  +   </s1>
  +   
  + </body>
  +</document>
  
  
  

----------------------------------------------------------------------
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