Sébastien Geindre wrote: > i need to make a conditional treatment in my site > > generator > transformer A > if condition on xml from transformerA --> transformer B1 > else --> transformer B2 > transformer C > serializer > > the condition is computed on xml data and global variables
What you ask for is not compatible with the way Cocoon works. It is my understanding that Cocoon pipelines work like this: 1. a HTTP request reaches Cocoon; 2. the request is dispatched to the right (sub-)sitemap; 3. the tree of all matchers, selectors and actions in that sitemap is executed, meaning that each of them is asked (in hierarchical order) to make its decision and optionally perform any side effects. What comes out of step 3. is a linear sequence of components, comprising a generator, zero or more transformers and a serializer. (Readers and aggregators are chosen at this time too.) 4. This chain of components is then executed in a streaming fashion, meaning that the serializer can (in theory) start outputting the result document well before the generator is finished*; 5. the result of the serialization is sent as a HTTP response, again in a streaming, progressive way, at least in theory. In any case, streaming or not, it should be clear that you cannot choose what components to use in the pipeline (step 3.) based on the intermediate results of the component chain itself (step 4.) I suggest you either: - make the choice between B1 and B2 based on the request data only, or - merge transformers B1 and B2 in a single transformer, or - always execute both transformers B1 and B2, controlling the function of each of them through appropriate elements in the XML stream, or - delegate the work of B1 and B2 (and possibly of C and serialization) to appropriate sub-pipelines, using either the CInclude transformer, a piece of Flowscript, <map:redirect-to>, or similar means; remember to use cocoon:/ URLs in the place of http:// whenever you can, as they are optimized for internal sub-requests. It's difficult to offer practical suggestions without knowing what your pipeline does. By the way, this whole email applies to Cocoon 2.1. I don't know how much of it is still true in 2.2. Tobia * A notable exception to this streaming behaviour is the XSL transformer, in the general case anyway, as has been pointed out in other threads. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
