cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Rocha <>
Subject Re: Dom elements as function Arguments in XSP file
Date Fri, 10 Mar 2000 01:02:17 GMT
Hi guys,

On Wed, 08 Mar 2000, Guy wrote:
> How Can I pass DOM Elements to the functions in the XSP file
> I have the following files
> <xsp:page ...
>  <page>
>    <title>Report</title>
>   <util:report>
>     <report_input>
>      <input1/>
>      ..
>      <inputn/>
>    </report_input>
>   </util:report>
> </page>
> </xsp:page>
> How can I  get the <report_input> tag as String or as Element in the
> Lib.xsl.xsp file?

I hope I'm understanding your requirement correctly (TM), :-)

The question could be rephrased as: "when a dynamic
XSP tag is represented in logic as a method, how can
I pass content nested inside the dynamic tag as argument(s)
to the underlying method?"

In the example above, you may want to process
<util:report> so that generated code looks like:

    User user = (User)session.getValue("User");
    ReportInput[] inputs = <somehow-get-all-inputs/>; // Here's the trick
    user.execReport(inputs, request, document)

Assuming you have XSL templates to transform each
<input1/> through <inputn/> to a suitable Java expression,
you could do  something like:

  <xsl:template match="util:report">
      User user = (User)session.getValue("User");
      ReportInput[] inputs = {
          <xsl:for-each select="report-input/*">
            <xsl:apply-templates/>,  // Note the comma
      user.execReport(inputs, request, document)

Hope this helps,


View raw message