Vadim Gritsenko pisze:
Grzegorz Kossakowski wrote:
Like:
<map:transform type="xslt" src="...">
<map:parameter name="param" value="some value"/>
?
Yes.
Well in this case, IIRC, these are *not* available in Cocoon 2.1 during
pipeline execution. Is there, given huge price of implementation, a
reason to make them available in Cocoon 2.2?
Ok, they are available during component's setup phase but no one can stop component from preserving parameters for later use, right? Exactly
that happens in o.a.c.generation.AbstractGenerator.setup() method so it's quite common practise.
It's basically price of having ObjectModel (and environment in
general) as a singleton object (actually it's scoped to the execution
of block, but it's not important here).
How parameters above relate to ObjectModel? I'm confused. Especially if
we assume they are not needed. :-?
Take a look at JXTemplateGenerator[1] and its performGeneration method:
public void performGeneration(Event startEvent, Event endEvent) throws
SAXException {
newObjectModel.markLocalContext();
FlowObjectModelHelper.fillNewObjectModelWithFOM(newObjectModel,
objectModel, parameters);
XMLConsumer consumer = new AttributeAwareXMLConsumerImpl(new
RedundantNamespacesFilter(this.xmlConsumer));
((Map) newObjectModel.get("cocoon")).put("consumer", consumer);
Invoker.execute(consumer, this.newObjectModel, new
ExecutionContext(this.definitions, this.scriptManager,
this.manager), null, namespaces, startEvent, null);
newObjectModel.cleanupLocalContext();
}
The most interesting line is the second one. fillNewObjectModelWithFOM method
looks like this:
public static void fillNewObjectModelWithFOM(ObjectModel newObjectModel,
final Map
objectModel, final Parameters parameters) {
((Map)newObjectModel.get("cocoon")).put("parameters", new
ParametersMap(parameters));
}
(ok, this whole helper is going to be removed at all)
Now you can see that parameters are available during pipeline execution in the
ObjectModel so it's possible to have such expressions:
${cocoon.parameters.some_param}
Still not sure how all this relates, so do not have good opinion.
I hope that you can understand the problem, now.
[1]
http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/java/org/apache/cocoon/template/JXTemplateGenerator.java
--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/