Hi Vadim,

I tried several possibilities, and I found a few points regarding my webapp
(I'm sure they're not C2 issues:-)):

1) A resource which contains no serializer stops the pipeline, returning no
output.

Such a sitemap fragment:

[...]
<map:resource name="crea-form-dati">
        <map:transform src="_xsl/data0.xsl"/>
        <map:transform src="_xsl/data.xsl"/>
</map:resource>
[...]

<map:call resource="crea-form-dati"/>
<map:serialize/>

[...]

simply returns me a 404. If I add a <map:serialize/> at the end of the
resource, it returns output again.
The problem is that the serializer, as you reminded me, really prevents any
further processing.
So it seems like:

a) A resource needs a serializer;
b) A serializer prevents any further processing;

=> In any matcher there can be only one <map:call resource="xxx"/>, and it
must be the last stage of the processing.

I'm sure I'm wrong. :-) But please help me find why!

2)


> Temporary work-around could be:
> <map:match pattern="data/*">
>   <map:match pattern="*">
>     <map:call resource="crea-form-dati"/>
>   </map:match>
>   <map:match pattern="*">
>     <map:call resource="aspetto-finale"/>
>   </map:match>
>   <map:serialize/>
> </map:match>

Just for curiosity, I tried the suggested workaround, but without the
<map:call resource="xxx"/> (which, as said, stops further processing). I
found that the nested matchers are not evaluated in the context of their
"father", but in the same context: that is, the nested <map:match
pattern="*"> must be changed to <map:match pattern="data/*">. A working
example is:

        <map:match pattern="data/*">
                [...]   
                <map:match pattern="data/*">
                        <map:transform src="_xsl/data0.xsl"/>
                        <map:transform src="_xsl/data.xsl"/>
                </map:match>
                <map:match pattern="data/*">
                        <map:transform src="_xsl/style.xsl"/>
                </map:match>
                [...]
        </map:match>


Thanks,


L.




-----Messaggio originale-----
Da: Vadim Gritsenko [mailto:[EMAIL PROTECTED]]
Inviato: marted́ 30 luglio 2002 14.46
A: [EMAIL PROTECTED]
Oggetto: RE: Multiple map:resource calls


> From: Lorenzo De Sio [mailto:[EMAIL PROTECTED]]
> 
> Hi all,
> 
> it seems to me like it is not possible to perform multiple <map:call
> resource="xxx"/> calls in a single matcher.
> 
> Fragments from my sitemap:
> 
> [...]
> 
>  <map:resources>
>       <map:resource name="aspetto-finale">
>           <map:transform src="_xsl/style.xsl">
>               <map:parameter name="nome" value="{nome}"/>
>               <map:parameter name="cognome" value="{cognome}"/>
>               <map:parameter name="doc_name" value="{../1}"/>
>           </map:transform>
>           <map:serialize/>
>       </map:resource>
>       <map:resource name="crea-form-dati">
>               <map:transform src="_xsl/data0.xsl"/>
>               <map:transform src="_xsl/data.xsl"/>
>           <map:serialize/>
>       </map:resource>
>  </map:resources>
> 
> [...]
> 
>       <map:match pattern="data/*">
> 
>               [...]
> 
>               <map:call resource="crea-form-dati"/>

BTW, this (second call to resource) will never be executed because of
<map:serialize/> in first call to resource):

>               <map:call resource="aspetto-finale"/>
>               <map:serialize/>
>       </map:act>
>       </map:match>
> 
> [...]
> 
> Both resources work, if used only one at a time. But, as soon as I try
to
> use both of them in a single matcher, I get the following exception:
> 
>       duplicate definition of variable methodName in method
matchN10092
> [...] duplicate definition of variable argTypes in method matchN10092
[...]
> duplicate definition of variable argValues in method matchN10092 [...]
> 
> which is obvious, if we look at the generated sitemap.java:
> 
>       map = new HashMap(1);
> 
>       String methodName = "resource_" + substitute(listOfMaps,
> "crea_form_dati");
>       listOfMaps.add(map);
>       this.dumpParameters(listOfMaps);
>       Class[] argTypes = new Class[] {StreamPipeline.class,
> EventPipeline.class, List.class, Environment.class, String.class,
> Boolean.TYPE};
>       Object[] argValues = new Object[] {pipeline, eventPipeline,
> listOfMaps, environment, cocoon_view, new Boolean(internalRequest)};
>       if (true) return invokeMethod(methodName, argTypes, argValues);
> 
>        map = new HashMap(1);
> 
>       String methodName = "resource_" + substitute(listOfMaps,
> "aspetto_finale");
>       listOfMaps.add(map);
>       this.dumpParameters(listOfMaps);
>       Class[] argTypes = new Class[] {StreamPipeline.class,
> EventPipeline.class, List.class, Environment.class, String.class,
> Boolean.TYPE};
>       Object[] argValues = new Object[] {pipeline, eventPipeline,
> listOfMaps, environment, cocoon_view, new Boolean(internalRequest)};
>       if (true) return invokeMethod(methodName, argTypes, argValues);
> 
> 
> Any hints? Am I doing wrong in trying to call two resources in a
matcher?
> Are there any correct alternatives?

Congratulations, you found a bug!
Temporary work-around could be:


<map:match pattern="data/*">
  <map:match pattern="*">
    <map:call resource="crea-form-dati"/>
  </map:match>
  <map:match pattern="*">
    <map:call resource="aspetto-finale"/>
  </map:match>
  <map:serialize/>
</map:match>


Vadim


> 
> Thanks in advance to anyone,
> 
> L.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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

Reply via email to