Thanks for your answer and sorry for my late reply!
Your suggestion led me to an even better solution that actually works
beautiful with Cocoon 2.1.7:
On creation of the Form object you pass it an URI to a pipeline which
already runs the i18n-Transformer:
--- in sitemap.xmap ---
<map:match pattern="get-form-definition/*">
<map:generate src="forms/{1}_model.xml"/>
<map:transform type="i18n">
<map:parameter name="locale" value="de"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
--- in flow ---
var form = new Form("cocoon:/get-form-definition/...");
--- in JXTemplate ---
<!-- Define macro for easier usage: -->
<jx:macro name="xmlize-widget-label">
<jx:parameter name="widget"/>
<jx:set var="ignored" value="${widget.generateLabel(cocoon.consumer)}"/>
</jx:macro>
<!-- Use somewhere in your page: -->
<xmlize-widget-label value="${widget}"/>
--- End of samples ---
This way you get both, i18n of labels and easy (and hopefully fast) access
to widget labels.
It allows us to write a generic solution which dynamically creates a summary
page and the mail content, without having to write summary page and mail
creation with heavily duplicated code and data.
The tricky part on the solution was to get the knowledge, that
cocoon.consumer is the content handler of the currently displayed jxtemplate
page which can be directly passed to any method, needing a content handler.
At least I did find nothing both on the Flowscript nor on the JXTemplate
documentation.
I placed a comment on the following page, since I can not edit it directly:
http://cocoon.zones.apache.org/daisy/documentation/745/511.html
Cheers,
Andreas
> -----Original Message-----
> From: Ard Schrijvers [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 05, 2006 12:26 PM
> To: [email protected]
> Subject: RE: Access cform field labels from flowscript
>
>
> Since you want an overview of the filled form, why not do
> something like:
>
> 1) call a pipeline from flow with params holding the
> widgetids:widgetvalues
> 2) generates a cocoon:/pipeline with the jx generator (see
> the cocoon:/pipeline below)
> 3) You now have an xml block having the translated labels and
> the corresponding widgetvalues
>
>
>
> The cocoon:/pipeline could look like below
>
> 1) generates the form definition
> 2) do your i18n transformer
> 3) Do an xsl outputting something like
> <field>
> <label>translated text</label>
> <postedfield>${username}</postedfield>
> <field>
>
>
> Think this is all (though, admit it is quite dirty :-) )
>
> AS
>
>
> H
>
> >
> > Hi,
> >
> > We have the following use case and I would like to know, if
> there is a
> > recommended solution for this:
> >
> > We are developing a generic form framework based on cform
> which should
> > roughly use the following workflow:
> > 1. Display input forms until successfully validated (can be
> > single-page as
> > well as multip-page froms)
> > 2. Display a summary page with all the entered information to
> > be confirmed
> > by the user
> > 3. Process data as follows:
> > - Store entered data in database
> > - Send mail to an employee who works with the form data
> > - Send mail to user with summary of entered data
> > 4. Display a summary page with all entered information,
> > success status and
> > print option
> >
> > Now we are using the following snippet to specify the
> > 18n-able labels in the
> > form definition:
> > <fd:field id="username">
> > <fd:label><i18n:text key="forms.username"/></fd:label>
> > <fd:datatype base="string"/>
> > </fd:field>
> >
> > Forms are correctly displayed and validated and everything
> > for the 1st step
> > is fine.
> >
> > But for the steps 2-4 I'm using flowscript and JXTemplates to
> > display the
> > summary page and plain flowscript to generate the mail content.
> > How can I access the field lables from within flowscript, so
> > that I can
> > generate a generic mail message in the following format:
> > <Label of field1>: <Value of field1>
> > <Label of field2>: <Value of field2>
> > ... where the labels are correctly translated?
> >
> > There are two challenges:
> >
> > 1. How to get at the label definition from within flowscript?
> > Here I'm missing a getLabel() method in the WidgetDefinition
> > interface.
> > The only thing I found was generateDisplayData() and
> > generateLabel() but
> > they deal with SAX events.
> >
> > 2. How to translate the labels within flowscript?
> > If I managed the 1st challange I will only get the i18n:text
> > element with
> > the key.
> > Since there is no i18n-Transformer involved in generating the
> > mail content,
> > I have to translate it manually.
> > Is it possible to reuse the configured catalogs of the
> > i18n-transformer from
> > flow and let it translate strings?
> >
> > Additionally I'd like to hear about other solutions which
> > might do the same
> > (I thought about generating the mails via pipelines with
> > i18n-transformer
> > included - but I'm unsure, if this is the way to go).
> >
> > Thanks for any hints,
> >
> > Andreas Hochsteger
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> Wurde auf Viren überprüft !!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]