cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Hoskens ...@schaubroeck.be>
Subject test expression in form
Date Wed, 29 Sep 2004 08:04:49 GMT
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


Mime
View raw message