You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Armaz Mellati <ar...@uninett.no> on 2004/06/30 12:40:36 UTC
problem choosing transform-src dynamically
Hi
I have big trouble deciding transform-src on runtime based on some value I
get from an action and xsp.
The point is, by the time I enter the "match" I don't know what the filename
is. I need to extract it from
my database.
As you see I have tried to use session-attr-module. I set the
HTML_stylesheet attribute in my report.xsp.
However it seems the pipeline reads the transform-src before running the
xsp. This behavior is very
unfortunate.
<map:match pattern="report">
<map:generate type="serverpages" src="xsp/report.xsp"
label="content"/>
<map:transform src="{session-attr:HTML_stylesheet}" label="debug" />
<map:serialize type="html"/>
</map:match>
Is there any other way tha using session-attr-module. How can I pass the
filename from an xsp or action on to the transformer ???
Any suggestion are mostly welcome.
Regards
Armaz
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: problem choosing transform-src dynamically
Posted by "g[R]eK" <gR...@warsztat.pac.pl>.
<. Hi Armaz! .>
Wednesday, June 30, 2004, 12:40:36 PM, you wrote:
AM> I have big trouble deciding transform-src on runtime based on some value I
AM> get from an action and xsp.
AM> The point is, by the time I enter the "match" I don't know what the filename
AM> is. I need to extract it from
AM> my database.
AM> As you see I have tried to use session-attr-module. I set the
AM> HTML_stylesheet attribute in my report.xsp.
AM> However it seems the pipeline reads the transform-src before running the
AM> xsp. This behavior is very
AM> unfortunate.
AM> <map:match pattern="report">
AM> <map:generate type="serverpages" src="xsp/report.xsp"
label="content"/>>
AM> <map:transform src="{session-attr:HTML_stylesheet}" label="debug" />
AM> <map:serialize type="html"/>
AM> </map:match>
AM> Is there any other way tha using session-attr-module. How can I pass the
AM> filename from an xsp or action on to the transformer ???
AM> Any suggestion are mostly welcome.
Mixing content generation with logic is not good practise. I think good solution
in your case is split generation and logic. Logic can be included to your own
xsp-action [1]. IMHO this is suitable solution of your problem.
BTW, if value 'HTML_stylesheet' is needed in only one place, you can use
<action:set-result> instead of using session attr.
Hope this help.
[1] http://wiki.cocoondev.org/Wiki.jsp?page=XSPAction
--
Best regards
<. g[R]eK mailto:gReK@warsztat.pac.pl .>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: problem choosing transform-src dynamically
Posted by Joerg Heinicke <jo...@gmx.de>.
On 30.06.2004 12:40, Armaz Mellati wrote:
> I have big trouble deciding transform-src on runtime based on some value I
> get from an action and xsp.
> The point is, by the time I enter the "match" I don't know what the filename
> is. I need to extract it from
> my database.
> As you see I have tried to use session-attr-module. I set the
> HTML_stylesheet attribute in my report.xsp.
> However it seems the pipeline reads the transform-src before running the
> xsp. This behavior is very
> unfortunate.
>
> <map:match pattern="report">
> <map:generate type="serverpages" src="xsp/report.xsp"
> label="content"/>
> <map:transform src="{session-attr:HTML_stylesheet}" label="debug" />
> <map:serialize type="html"/>
> </map:match>
>
>
> Is there any other way tha using session-attr-module. How can I pass the
> filename from an xsp or action on to the transformer ???
Additionally to the pure SoC issue g[R]eK mentioned the above is not
possible and you are forced to use an action. The pipeline is built and
later processed where xsp content generation obviously belongs to the
processing phase while determining the src of the transformer belongs to
the building phase. And at the method level: You have SAX events being
pushed through the pipeline. The serverpage *immediately* calls the
first method on the transformer, not when it is finished completely. So
you probably grab a value that is not even set.
When using an action you should neither use session attributes but the
action return type to get the value: The action returns a map, in this
map you use a special key to store your param, this one one you can get
in the map:transform/@src:
<map:match pattern="report">
<map:act type="anAction">
<map:generate type="serverpages" src="xsp/report.xsp"/>
<map:transform src="{myMapKey}" label="debug"/>
<map:serialize type="html"/>
</map:act>
</map:match>
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org