Luca Morandini pisze:
> Grzegorz Kossakowski wrote:
>> Luca Morandini pisze:
>>>
>>> I presume that a way to disentangle forms and ajax blocks would be to
>>> make two different forms-field-styling.xsl (one with Javascript and/or
>>> Ajax, the other without Javascript), loaded conditionally on ajax="true"
>>> by forms-samples-styling.xsl.
>>
>> That would be quite difficult because there is no easy way to
>> conditionally load XSL templates. 
> 
> Gee... yes, that's one of the things XSLT is not supposed to do.
> 
> 
>> What
>> about making inclusion of JS libraries in generated HTML forms
>> conditional? It would only require
>> tweaking existing templates.
> 
> Dropping libraries is easy, what's not so easy is the dropping of the
> Javascript code poping up here and there.
> 
> Another solution would be to make every template "dual":
> <xsl:template match="fi:validation-message">
>     <xsl:choose>
>         <xsl:when test="$ajax-mode='true'">
>             <span dojoType="forms:infopopup"
>             ...
>             </span>
>         </xsl:when>
>         <xsl:otherwise>
>             <span style="display:none"
>             ...
>             </span>
>         </xsl:otherwise>
>     </xsl:choose>
> </xsl:template>
> 
> Come to think of it, there should be three modes, not teo: ajax,
> javascript, no-javascript.
> Hence, ajax='true' should be changed too, maybe to
> client='static|dynamic|ajax'... hmm... the matter is getting hairy.

Ah, right. Not sure what's the best solution for this. Have you done some 
research on how others
avoid using JS for things like pop-up windows? I hope you can come up with 
something general that
won't increase complexity of existing XSLT templates.

If it's not possible I would recommend creation of your own forms-customized 
block that will inherit
from original Cocoon block and override necessary templates. Thanks to SSF 
capabilities there are
very clean ways to customize such things.

-- 
Grzegorz Kossakowski

Reply via email to