You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Vadim Gritsenko <va...@verizon.net> on 2003/11/11 15:15:45 UTC

WoodyTransformer: radio buttons

Hey guys,

Has anybody have any suggestions on how to make @required=true, 
<wi:styling list-type="radio"/>, widget make less ugly? Currently it 
looks like:
   (   ) Label for the first radio button
   ( o ) Second
   (   ) Third *
Where * indicates that the widget is required, but is higly misleading 
because it is attached to the third radio button.

I came up with several workarounds:
1) Change how woody transformer transformrms wt:widget-labels.
Currently, validation error messages and @required attribute are present 
only on wi:field (and similar elements). And wt:widget-label disappears 
completely, replaced by the content of the label. Instead, it can 
replace wt:widget-label with wi:widget-label, which has validation 
messages and required attribute. This way, you have more flexibility in 
styling the form, including placing of error messages.

2) Do not use woody-field-styling.xsl at all; roll your own... wi:field 
has all the necessary data.

3) Make woody-field-styling.xsl more flexible: divide field styling into 
several steps (using mode="" attribute on templates)

4) Ask list for other suggestions :)


BTW, is anybody against replacing <xsl:template 
name="woody-field-common"/> with <xsl:template match="wi:*" 
mode="common"> ? It's not possible to override in the including 
stylesheet named templates, but you can override match="" templates.

Vadim



Re: Woody: moded templates (Re: WoodyTransformer: radio buttons)

Posted by Joerg Heinicke <jh...@virbus.de>.
On 12.11.2003 17:50, Sylvain Wallez wrote:

> Joerg Heinicke wrote:
> 
>> On 11.11.2003 15:15, Vadim Gritsenko wrote:
>>
>>> BTW, is anybody against replacing <xsl:template 
>>> name="woody-field-common"/> with <xsl:template match="wi:*" 
>>> mode="common"> ? It's not possible to override in the including 
>>> stylesheet named templates, but you can override match="" templates.
>>
>>
>>
>> Some time ago I also started to do this, but I lost these changes (did 
>> I do this only in build/webapp and made a buil clean afterwards? :-( 
>> ). The named templates are not the problem if you use <xsl:import> 
>> instead of <xsl:include>. The real problem are special cases.
>>
>> <xsl:template match="wi:field">
>>   <xsl:call-template name="doSomething"/>
>> </xsl:template>
>>
>> <xsl:template name="doSomething">
>>   <xsl:choose>
>>     <xsl:when test="case1">..</xsl:when>
>>     <xsl:when test="case2">..</xsl:when>
>>     <xsl:otherwise>..</xsl:otherwise>
>>   </xsl:choose>
>> </xsl:template>
>>
>> while with modes:
>>
>> <xsl:template match="wi:field">
>>   <xsl:apply-templates select="." mode="doSomething"/>
>> </xsl:template>
>>
>> <xsl:template match="wi:field[case1]" mode="doSomething">
>> </xsl:template>
>>
>> <xsl:template match="wi:field[case2]" mode="doSomething">
>> </xsl:template>
>>
>> <xsl:template match="wi:field" mode="doSomething">
>> </xsl:template>
>>
>> and now imagein importing this stylesheet in another one. While you 
>> have to rewrite the complete named template, with the moded stylesheet 
>> you can overload exactly one special case.
>>
>> I volunteer doing this!
> 
> 
> 
> +1, I was also thinking to something along these lines, with some 
> additional modes such as "before-widget" and "after-widget" that would 
> allow, by overaloading in the including stylesheet, to redefine how and 
> where the "*" and validation messages appear relative to a widget.
> 
> We can however keep the named template as a convenience to ease writing 
> the moded templates (which would be just a <xsl:call-template> in their 
> standard form).

This should be done using

<xsl:apply-imports/>

Joerg


Re: Woody: moded templates (Re: WoodyTransformer: radio buttons)

Posted by Sylvain Wallez <sy...@apache.org>.
Joerg Heinicke wrote:

> On 11.11.2003 15:15, Vadim Gritsenko wrote:
>
>> BTW, is anybody against replacing <xsl:template 
>> name="woody-field-common"/> with <xsl:template match="wi:*" 
>> mode="common"> ? It's not possible to override in the including 
>> stylesheet named templates, but you can override match="" templates.
>
>
> Some time ago I also started to do this, but I lost these changes (did 
> I do this only in build/webapp and made a buil clean afterwards? :-( 
> ). The named templates are not the problem if you use <xsl:import> 
> instead of <xsl:include>. The real problem are special cases.
>
> <xsl:template match="wi:field">
>   <xsl:call-template name="doSomething"/>
> </xsl:template>
>
> <xsl:template name="doSomething">
>   <xsl:choose>
>     <xsl:when test="case1">..</xsl:when>
>     <xsl:when test="case2">..</xsl:when>
>     <xsl:otherwise>..</xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
>
> while with modes:
>
> <xsl:template match="wi:field">
>   <xsl:apply-templates select="." mode="doSomething"/>
> </xsl:template>
>
> <xsl:template match="wi:field[case1]" mode="doSomething">
> </xsl:template>
>
> <xsl:template match="wi:field[case2]" mode="doSomething">
> </xsl:template>
>
> <xsl:template match="wi:field" mode="doSomething">
> </xsl:template>
>
> and now imagein importing this stylesheet in another one. While you 
> have to rewrite the complete named template, with the moded stylesheet 
> you can overload exactly one special case.
>
> I volunteer doing this!


+1, I was also thinking to something along these lines, with some 
additional modes such as "before-widget" and "after-widget" that would 
allow, by overaloading in the including stylesheet, to redefine how and 
where the "*" and validation messages appear relative to a widget.

We can however keep the named template as a convenience to ease writing 
the moded templates (which would be just a <xsl:call-template> in their 
standard form).

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Woody: moded templates (Re: WoodyTransformer: radio buttons)

Posted by Joerg Heinicke <jh...@virbus.de>.
On 11.11.2003 15:15, Vadim Gritsenko wrote:

> BTW, is anybody against replacing <xsl:template 
> name="woody-field-common"/> with <xsl:template match="wi:*" 
> mode="common"> ? It's not possible to override in the including 
> stylesheet named templates, but you can override match="" templates.

Some time ago I also started to do this, but I lost these changes (did I 
do this only in build/webapp and made a buil clean afterwards? :-( ). 
The named templates are not the problem if you use <xsl:import> instead 
of <xsl:include>. The real problem are special cases.

<xsl:template match="wi:field">
   <xsl:call-template name="doSomething"/>
</xsl:template>

<xsl:template name="doSomething">
   <xsl:choose>
     <xsl:when test="case1">..</xsl:when>
     <xsl:when test="case2">..</xsl:when>
     <xsl:otherwise>..</xsl:otherwise>
   </xsl:choose>
</xsl:template>

while with modes:

<xsl:template match="wi:field">
   <xsl:apply-templates select="." mode="doSomething"/>
</xsl:template>

<xsl:template match="wi:field[case1]" mode="doSomething">
</xsl:template>

<xsl:template match="wi:field[case2]" mode="doSomething">
</xsl:template>

<xsl:template match="wi:field" mode="doSomething">
</xsl:template>

and now imagein importing this stylesheet in another one. While you have 
to rewrite the complete named template, with the moded stylesheet you 
can overload exactly one special case.

I volunteer doing this!

Joerg


Re: WoodyTransformer: radio buttons

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2003-11-11 at 15:15, Vadim Gritsenko wrote:
> Hey guys,
> 
> Has anybody have any suggestions on how to make @required=true, 
> <wi:styling list-type="radio"/>, widget make less ugly? Currently it 
> looks like:
>    (   ) Label for the first radio button
>    ( o ) Second
>    (   ) Third *
> Where * indicates that the widget is required, but is higly misleading 
> because it is attached to the third radio button.

For this particular case it can maybe be solved by putting these in a
two-column table, with the radio buttons in the first column and the *
in the second column.

> 
> I came up with several workarounds:
> 1) Change how woody transformer transformrms wt:widget-labels.
> Currently, validation error messages and @required attribute are present 
> only on wi:field (and similar elements). And wt:widget-label disappears 
> completely, replaced by the content of the label. Instead, it can 
> replace wt:widget-label with wi:widget-label, which has validation 
> messages and required attribute. This way, you have more flexibility in 
> styling the form, including placing of error messages.

Yes, but then you'd have to place the required indication and validation
errors with together with the label. What if I want to put them
somewhere else completely?

In general I think there are 4 items that one may like to place
separately: the label, the widget itself, the required indication and
the validation errors.

I think it would then be better to introduce new tags like wt:required
and wt:validation-errors so that each of these can be retrieved
separately.

Whether the stylesheet needs to put the required indication and
validation errors next to the widget could be controlled by a stylesheet
parameter, with as default behaviour the situation like it is now.

> 
> 2) Do not use woody-field-styling.xsl at all; roll your own... wi:field 
> has all the necessary data.
> 
> 3) Make woody-field-styling.xsl more flexible: divide field styling into 
> several steps (using mode="" attribute on templates)
> 
> 4) Ask list for other suggestions :)
> 
> 
> BTW, is anybody against replacing <xsl:template 
> name="woody-field-common"/> with <xsl:template match="wi:*" 
> mode="common"> ? It's not possible to override in the including 
> stylesheet named templates, but you can override match="" templates.

+1 for making them overridable (and thus also for what Joerg was
proposing)

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org