You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Antonio Gallardo <ag...@agssa.net> on 2004/10/03 23:46:14 UTC

Re: test expression in form

Hi Jan,

Try the JXTemplate Generator:

http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html

Maybe the <jx:if> is what you are looking for:
http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html#if

Best Regards,

Antonio Gallardo

Jan Hoskens dijo:
> Hi,
>
> I'm stuck with the following situation:
>
> A list of forms is available to be filled in by users. These forms may
> be transformed to pdf at any time. Some information in a form depends on
> other information in the same form. For example: if the user has
> selected the value "yes I love candy" in field A then the field B
> "Favourite candy is Twix" is of importance too and should be printed on
> the pdf. When the user had selected "No, I don't like candy" field B
> should not be printed (however it could contain a value that should be
> disregarded). So on screen when filling in the form (and maybe changing
> it afterwards, the user can save the form to adapt it later) all fields
> are available, but on pdf a selection should be made.
>
> As I'm talking about a bunch of forms, each with it's own dependencies
> among the fields, I was thinking about setting a depends-on attribute
> (something like a xsl test expression) wherever needed in the form. But
> how can I actually extract these tests and apply them. Eg. it would be
> fantastic if I an xslt stylesheet could extract the test and actually
> perform it (so I would have a xslt-compatible expression in my form, and
> this should be extracted and evaluated by xslt). It seems to me that
> there's no way to do this as xslt would have to do two steps ( Prove me
> wrong here;-):
>
> eg: <xsl:if test="@depends-on"> checks on the attribute, but I need to
> evaluate the expression in that attribute. So step one: put in value of
> attribute, step two: evaluate that expression
>     (think of : <xsl:if test="{@depends-on}"> where {} is evaluated first)
>
> I'm wondering if it's possible to write a transformer that can check
> these dependencies, and how to check that testexpression in @depends-on.
> It will be likely that it's a xpath expression, so can I write a
> domtransformer that does a xpath evaluation? More specifically: in that
> transformer, how/where can I access the whole document and evaluate an
> xpath expression? Maybe there's an example somewhere in cocoon? Would
> this slow everything down a lot because it's dom and not sax? Or are
> there better ways to do something alike?
>
> Kind Regards,
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org