Avoiding duplication of code in XMAPs is handled by "resources":
  <map:resources>
    <map:resource name="finish">
      <map:transform src="transform1.xsl"/>
      <map:transform src="transform2.xsl"/>
      <map:transform type="i18n">
        <map:parameter name="locale" value="{request:locale}"/>
      </map:transform>
      <map:serialize type="xml"/>
    </map:resource>
  </map:resources>
...
<map:match pattern="**">
  <map:match pattern="**/special treatment_area/**">
     <!-- Pattern contains "/special treatment_area/" -->
     <map:generate src="Special.xml"/>
     <map:call resource="finish"/>
  </map:match>
  <!-- Pattern does not contain "/special treatment_area/" -->
  <map:generate src="NotSpecial.xml"/>
  <map:call resource="finish"/>
</map:match>

Note that resources can contain any portion of a pipeline and do not
require any specific components.  A resource could be just a
Generator, just a Serializer, a few Transformers, or any combination
as long as every pipeline that calls the resources has one and only
one Generator/Aggregator and at least one Serializer.  Multiple
Serializers are allowed; the first Serializer encountered is the
"return" command ending processing.  Every <map:call> statement is
replaced by the code in the named resource.

We discuss using variables with resources in the advanced class.

solprovider

On 3/5/08, Rainer Pruy <[EMAIL PROTECTED]> wrote:
> Thanks,
>  yes, I am aware of nesting.
>
>  To get closer to my question, just assume (may not have been stated clearly 
> by me with initial post):
>
>  - the condition "does not contain C" is not stated easily in terms of 
> wildcard
>   (just consider: what is the "not" of pattern "**/special treatment_area/**"
>    and keep in mind, that I do not have control over the undelying namespace
>    as I then could move the normal processing to "**/normal/**" e.g.)
>
>  - the condition does only affect generators (in my case usually aggregators),
>   the rest of the pipeline will be the same
>   Thus, using the "return" character of "serialize" would also require 
> multiplying the same pipeline
>
>  Rainer
>
>  [EMAIL PROTECTED] schrieb:
>
> > Are you aware that pipelines can be nested?
>  > http://solprovider.com/lenya/nesting
>  >
>  > <map:match pattern="**">
>  >    <map:match pattern="**/C/**">
>  >       <!-- Pattern contains "/C/" -->
>  >       <map:generate src="FoundC.xml"/>
>  >       <map:serialize type="xml"/>
>  >    </map:match>
>  >    <!-- Pattern does not contain "C" -->
>  >    <map:generate src="NoCFound.xml"/>
>  >    <map:serialize type="xml"/>
>  > </map:match>
>  >
>  > Each piece of code must start with an Generator/Aggregator and end
>  > with a Serializer (or call a Reader or Redirector.)  Think of
>  > <map:serialize> as a return statement.
>  >
>  > Is this the information you need?  Or did I miss the problem?
>  >
>  > solprovider
>  >
>  > On Thu, Feb 21, 2008 at 8:49 AM, Rainer Pruy <[EMAIL PROTECTED]> wrote:
>  >>  But what to do, when one needs to handle X/c/** and X/** (excluding 
> X/c/**) different?
>  >>  (At least if the contained components are not "final" (serialize, read))
>  >>
>  >>  ("X" is an arbitrary path, not having any single path component "c";
>  >>   while "c" is a simple path component (no "/"))
>  >>
>  >>  Using combinations of wildcard macher and simple selector does work, but 
> is quite verbose.
>  >>  A "not c" pattern is not generally available (decomposing c into 
> positive and negative set patterns
>  >>  might work, but will be even more writing for c's that include several 
> characters).
>  >>
>  >>  Any selector I did miss?
>  >>
>  >>  Regards,
>  >>  Rainer Pruy
>  Rainer Pruy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to