You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marc Salvetti <ma...@notremanou.net> on 2005/01/18 13:29:30 UTC

modifying the style of required widgets in CForms

Hello,

i've been asked to put a background color on the required fields in 
cforms, i don't really understand where i need to add the attribute.
I've been trying to edit forms-field-styling.xsl but
- I don't like the idea of updating a file coming from the distribution
- I don't find the right place in the file, i think it should be here 
but for some reason the attribute isn't added  :

  <!--+
      | Handling the common styling. You may only add attributes to the 
output
      | in this template as later processing might add attributes too, for
      | example @checked or @selected
      +-->
  <xsl:template match="fi:*" mode="styling">
   <xsl:apply-templates select="fi:styling/@*" mode="styling"/>
    <!-- HERE -->
    <xsl:attribute name="style">backround-color:yellow;</xsl:attribute>
    <!--+
        | @listbox-size needs to be handled separately as even if it is not
        | specified some output (@size) must be generated.
        +-->
    <xsl:if 
test="self::fi:field[fi:selection-list][fi:styling/@list-type = 
'listbox'] or
                  self::fi:multivaluefield[not(fi:styling/@list-type = 
'checkbox')]">
      <xsl:variable name="size">
        <xsl:value-of select="fi:styling/@listbox-size"/>
        <xsl:if test="not(fi:styling/@listbox-size)">5</xsl:if>
      </xsl:variable>
      <xsl:attribute name="size">
        <xsl:value-of select="$size"/>
      </xsl:attribute>
    </xsl:if>
  </xsl:template>

does someone knows of a good technique to do this (if possible outside 
of forms-field-styling.xsl)

thanks,

Marc

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


Re: modifying the style of required widgets in CForms

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jan 18, 2005, at 4:29 AM, Marc Salvetti wrote:

> Hello,
>
> i've been asked to put a background color on the required fields in 
> cforms, i don't really understand where i need to add the attribute.
> I've been trying to edit forms-field-styling.xsl but
> - I don't like the idea of updating a file coming from the distribution
well... :-)

> - I don't find the right place in the file, i think it should be here 
> but for some reason the attribute isn't added  :
>
>  <!--+
>      | Handling the common styling. You may only add attributes to the 
> output
>      | in this template as later processing might add attributes too, 
> for
>      | example @checked or @selected
>      +-->
>  <xsl:template match="fi:*" mode="styling">
>   <xsl:apply-templates select="fi:styling/@*" mode="styling"/>
>    <!-- HERE -->
>    <xsl:attribute name="style">backround-color:yellow;</xsl:attribute>
>

That works for me.  Actually I added this:

     <xsl:if test="@required='true'">
       <xsl:attribute name="style">background-color: 
yellow;</xsl:attribute>
     </xsl:if>

However:

1) I had to play funny games w/ Cocoon to get it to "take".  I hit the 
mysterious "Clear cache" sample page (mysterious to me, because I've 
never looked at what it actually does), and that didn't help.  I 
renamed samples/blocks/forms/resources to resources.save, refreshed the 
page (getting the expected error from cocoon), and re-renamed it back 
again, then the change took effect.  Me no understand, but oh well...

2) Not all browsers support all css properties in <input> elements, 
e.g. the background-color doesn't work in Safari... but it does in 
Firefox.

HTH,
—ml—


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


Re: modifying the style of required widgets in CForms

Posted by Marc Salvetti <ma...@notremanou.net>.

Mark Lundquist a écrit :

> Thanks for the detail.  See below:
>
> On Jan 19, 2005, at 10:20 PM, Marc Salvetti wrote:
>
>> I tried your last suggestion, but that doesn't seem to help,
>> so here is what the custom-styling stylesheet looks like so far :
>>
>> <?xml version="1.0"?>
>>
>> <xsl:stylesheet version="1.0"
>>                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>                xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
>>                xmlns:exsl="http://exslt.org/common" >
>>
>> <xsl:import href="../resources/forms-samples-styling.xsl" />
>>
>> <xsl:template match="*" mode="custom-styling">
>>    <xsl:param name="required" />
>>    <xsl:copy>
>
>     <!-- You forgot to add this (see my eariler email): -->
>     <xsl:apply-templates select="@* />

>     <!-- That's why the attributes, e.g. 'rows' & 'cols' are lost... -->

I tried it before but it didn't work, that's why i removed it...

>>        <xsl:if test="$required='true'">
>>            <xsl:attribute name="class">required-field</xsl:attribute>
>>        </xsl:if>
>>    </xsl:copy>
>> </xsl:template>
>>
>> <xsl:template match="fi:field" mode="styling">
>>    <!-- Apply the default transformation -->
>>    <xsl:variable name="control">
>>        <xsl:apply-imports/>
>>    </xsl:variable>
>>    <!-- Now apply our styling -->
>>    <xsl:apply-templates select="exsl:node-set($control)" 
>> mode="custom-styling">
>
>         <!-- d'oh, my bad!
>
>>        <xsl:with-param name="required" value="@required" />
>
>        That should be:
>        -->
>           <xsl:with-param name="required" select="@required" />

all right! one error solved (btw, why doesn't it produce an exception 
with value ?)

>
>>    </xsl:apply-templates>
>> </xsl:template>
>>
>> </xsl:stylesheet>
>
>
> Give that a shot! :-)

well, same same as they say here :-)

html output :

<textarea title="" name="comment" id="comment"/>
<span class="forms-field-required"> * </span>


Cheers,

Marc

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


Re: modifying the style of required widgets in CForms

Posted by Mark Lundquist <ml...@wrinkledog.com>.
Thanks for the detail.  See below:

On Jan 19, 2005, at 10:20 PM, Marc Salvetti wrote:

> I tried your last suggestion, but that doesn't seem to help,
> so here is what the custom-styling stylesheet looks like so far :
>
> <?xml version="1.0"?>
>
> <xsl:stylesheet version="1.0"
>                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
>                xmlns:exsl="http://exslt.org/common" >
>
> <xsl:import href="../resources/forms-samples-styling.xsl" />
>
> <xsl:template match="*" mode="custom-styling">
>    <xsl:param name="required" />
>    <xsl:copy>
	<!-- You forgot to add this (see my eariler email): -->
	<xsl:apply-templates select="@* />
	<!-- That's why the attributes, e.g. 'rows' & 'cols' are lost... -->
>        <xsl:if test="$required='true'">
>            <xsl:attribute name="class">required-field</xsl:attribute>
>        </xsl:if>
>    </xsl:copy>
> </xsl:template>
>
> <xsl:template match="fi:field" mode="styling">
>    <!-- Apply the default transformation -->
>    <xsl:variable name="control">
>        <xsl:apply-imports/>
>    </xsl:variable>
>    <!-- Now apply our styling -->
>    <xsl:apply-templates select="exsl:node-set($control)" 
> mode="custom-styling">
	    <!-- d'oh, my bad!
>        <xsl:with-param name="required" value="@required" />
	   That should be:
	   -->
           <xsl:with-param name="required" select="@required" />

>    </xsl:apply-templates>
> </xsl:template>
>
> </xsl:stylesheet>

Give that a shot! :-)
—ml—


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


Re: modifying the style of required widgets in CForms

Posted by Marc Salvetti <ma...@notremanou.net>.
I tried your last suggestion, but that doesn't seem to help,
so here is what the custom-styling stylesheet looks like so far :

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
                xmlns:exsl="http://exslt.org/common" >

<xsl:import href="../resources/forms-samples-styling.xsl" />

<xsl:template match="*" mode="custom-styling">
    <xsl:param name="required" />
    <xsl:copy>
        <xsl:if test="$required='true'">
            <xsl:attribute name="class">required-field</xsl:attribute>
        </xsl:if>
    </xsl:copy>
</xsl:template>

<xsl:template match="fi:field" mode="styling">
    <!-- Apply the default transformation -->
    <xsl:variable name="control">
        <xsl:apply-imports/>
    </xsl:variable>
    <!-- Now apply our styling -->
    <xsl:apply-templates select="exsl:node-set($control)" 
mode="custom-styling">
        <xsl:with-param name="required" value="@required" />
    </xsl:apply-templates>
</xsl:template>

</xsl:stylesheet>

here is the example widget i'm testing on :

    <ft:widget id="comment">
        <fi:styling type="textarea" cols="80" rows="10" />
    </ft:widget>

here is the resulting html :

    <textarea title="" name="comment" id="comment"/>
    <span class="forms-field-required"> * </span>

textarea is applied no pb,
cols and rows attributes are lost,
class="required-filed" is not copied.

Maybe you can see better where is the problem ?

Thanks for your help

Marc


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


Re: modifying the style of required widgets in CForms

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jan 19, 2005, at 7:29 PM, Marc Salvetti wrote:

> nope ! lost your bet, the result is just exactly the same :-\

bummer!

>
> i tried this instead :
>
>    <xsl:copy-of select=".">
>        <xsl:if test="$required='true'">
>            <xsl:attribute name="class">required-field</xsl:attribute>
>        </xsl:if>
>    </xsl:copy-of>
>
> and this copies all the attributes of the <fi:styling> tag to the 
> control (even the type="textarea" which is not supposed to be...) but 
> the class="required-filed" is still not copied !

Well, check the reference on <xml:copy-of>... its contents are always 
ignored.

Can you show your whole stylesheet?  There should be no <fi:styling> 
element left by the time you get to the "custom-styling" moded 
template, because we're invoking it on the result of applying the 
imported template which has already translated the fi:* to HTML.

> Then i wonder (again) if we are matching the correct element. I think 
> maybe we are matching the fi:field element where we should match the 
> fi:styling... or the opposite :-D

We _do_ want to match fi:field — in the wrapper template (the one that 
does the <apply-imports>). This template  has mode="styling", so it 
only matches for <apply-templates mode="styling">.

But I think I see the problem... we're also going to match all kinds of 
other stuff for which there are specific templates in 
forms-field-styling.  My bad again!  So the wrapper template should 
match="fi:field", not fi:*.  Give that a try... but if it doesn't work, 
let's have a look at your whole stylesheet! :-)

GL,
—ml—


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


Re: modifying the style of required widgets in CForms

Posted by Marc Salvetti <ma...@notremanou.net>.
Hello Marc, thx again for the answer,

Mark Lundquist a écrit :

>
>
> Aw, phooey!  I had a brain-o there, I totally meant "styling", but in 
> my example I wrote "common" (right after I got through telling you 
> that "common" was the wrong one! :-).  Sorry, my bad.
>
No worries, this is already very confusing anyway ;-)

> Yes, mode="styling" is right.
>
> Matching "*" on the mode="custom-styling" is right, too — then you 
> will pick up the other kinds of form control elements, as you say.
>
> I forgot about attributes.  Try adding this immediately inside the 
> <xsl:copy> in the custom-styling mode template:
>
>     <xsl:apply-templates select="@*" />
>
> I'll bet that fixes it!
>
nope ! lost your bet, the result is just exactly the same :-\

i tried this instead :

    <xsl:copy-of select=".">
        <xsl:if test="$required='true'">
            <xsl:attribute name="class">required-field</xsl:attribute>
        </xsl:if>
    </xsl:copy-of>

and this copies all the attributes of the <fi:styling> tag to the 
control (even the type="textarea" which is not supposed to be...) but 
the class="required-filed" is still not copied !
Then i wonder (again) if we are matching the correct element. I think 
maybe we are matching the fi:field element where we should match the 
fi:styling... or the opposite :-D

> —ml— (eagerly awaiting your report... I love it when other people try 
> out my ideas for me :-) :-) :-)
>
Lol, well here is my report, do you have more ideas ?

Cheers,

Marc

>
> ---------------------------------------------------------------------
> 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


Re: modifying the style of required widgets in CForms

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jan 18, 2005, at 10:38 PM, Marc Salvetti wrote:

> Thanks a lot for your answers, i've just tried your idea, but i still 
> can't get it to work.
> Here is what i tried
>
> <xsl:import href="../resources/forms-samples-styling.xsl" />
> <xsl:template match="*" mode="custom-styling">
>    <xsl:param name="required" />
>    <xsl:copy>
>        <xsl:if test="$required='true'">
>            <xsl:attribute name="class">required-field</xsl:attribute>  
>  <!-- (visual properties belong in CSS) -->
>        </xsl:if>
>    </xsl:copy>
> </xsl:template>
>
> <xsl:template match="fi:*" mode="common">
>    <!-- Apply the default transformation -->
>    <xsl:variable name="control">
>        <xsl:apply-imports/>
>    </xsl:variable>
>    <!-- Now apply our styling -->
>    <xsl:apply-templates select="exsl:node-set($control)" 
> mode="custom-styling">
>        <xsl:with-param name="required" value="@required" />
>    </xsl:apply-templates>
> </xsl:template>
>
> notice the use of match="*" in the custom-styling template because i 
> don't really know what's returned by exsl:node-set($control), but i 
> guess it must be something like fi:* as not only the input control is 
> concerned here, but also select, textarea, etc...
> However, if i match
> - "*"    i get an empty <span class="forms-field-required"></span> 
> after the control (the * is gone somewhere)
> - "fi:*" i get the *, but not the <span> tag
>
> and in both cases i don't get the class="required-field" attribute 
> inserted on the control
>
> I'm pretty new to xsl, so i'm not sure to understand the functioning 
> of this, but i think if the template to be modified is the one spotted 
> first (mode="styling", not mode="common"), maybe the second template 
> should be <xsl:template match="fi:*" mode="styling">
> However, if i try it,  i get the <span 
> class="forms-field-required">*</span> correctly, but the fi:styling of 
> the control is lost (cols, lines....)
>
> and i still don't get the class="required-field" attribute inserted on 
> the control :-\
>
> i'm a bit confused now...
>
> Marc

Aw, phooey!  I had a brain-o there, I totally meant "styling", but in 
my example I wrote "common" (right after I got through telling you that 
"common" was the wrong one! :-).  Sorry, my bad.

Yes, mode="styling" is right.

Matching "*" on the mode="custom-styling" is right, too — then you will 
pick up the other kinds of form control elements, as you say.

I forgot about attributes.  Try adding this immediately inside the 
<xsl:copy> in the custom-styling mode template:

	<xsl:apply-templates select="@*" />

I'll bet that fixes it!

—ml— (eagerly awaiting your report... I love it when other people try 
out my ideas for me :-) :-) :-)


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


Re: modifying the style of required widgets in CForms

Posted by Marc Salvetti <ma...@notremanou.net>.
Thanks a lot for your answers, i've just tried your idea, but i still 
can't get it to work.
Here is what i tried

<xsl:import href="../resources/forms-samples-styling.xsl" />
<xsl:template match="*" mode="custom-styling">
    <xsl:param name="required" />
    <xsl:copy>
        <xsl:if test="$required='true'">
            <xsl:attribute name="class">required-field</xsl:attribute>   
<!-- (visual properties belong in CSS) -->
        </xsl:if>
    </xsl:copy>
</xsl:template>

<xsl:template match="fi:*" mode="common">
    <!-- Apply the default transformation -->
    <xsl:variable name="control">
        <xsl:apply-imports/>
    </xsl:variable>
    <!-- Now apply our styling -->
    <xsl:apply-templates select="exsl:node-set($control)" 
mode="custom-styling">
        <xsl:with-param name="required" value="@required" />
    </xsl:apply-templates>
</xsl:template>

notice the use of match="*" in the custom-styling template because i 
don't really know what's returned by exsl:node-set($control), but i 
guess it must be something like fi:* as not only the input control is 
concerned here, but also select, textarea, etc...
However, if i match
- "*"    i get an empty <span class="forms-field-required"></span> after 
the control (the * is gone somewhere)
- "fi:*" i get the *, but not the <span> tag

and in both cases i don't get the class="required-field" attribute 
inserted on the control

I'm pretty new to xsl, so i'm not sure to understand the functioning of 
this, but i think if the template to be modified is the one spotted 
first (mode="styling", not mode="common"), maybe the second template 
should be <xsl:template match="fi:*" mode="styling">
However, if i try it,  i get the <span 
class="forms-field-required">*</span> correctly, but the fi:styling of 
the control is lost (cols, lines....)

and i still don't get the class="required-field" attribute inserted on 
the control :-\

i'm a bit confused now...

Marc

Mark Lundquist a écrit :

>
> On Jan 18, 2005, at 10:12 AM, Joerg Heinicke wrote:
>
>> On 18.01.2005 13:29, Marc Salvetti wrote:
>>
>>> [...snip]
>>
>>
>> The template for required is a different one:
>>
>>   <!--+
>>       | Common stuff like fi:validation-message, @required.
>>       +-->
>>   <xsl:template match="fi:*" mode="common">
>>     <!-- validation message -->
>>     <xsl:apply-templates select="fi:validation-message"/>
>>     <!-- required mark -->
>>     <xsl:if test="@required='true'">
>>       <span class="forms-field-required"> * </span>
>>     </xsl:if>
>>   </xsl:template>
>
>
> Nope, Marc got it right :-)... The mode="common" template generates 
> the 'annotations', not the control itself.
>
>>
>>> does someone knows of a good technique to do this (if possible 
>>> outside of forms-field-styling.xsl)
>>
>>
>> Write your own stylesheet, import forms-samples-styling.xsl into it 
>> and overload the template for the required attribute.
>>
>> myforms.xsl:
>>
>> <xsl:stylesheet>
>>
>> <xsl:import href="forms-samples-styling.xsl"/>
>>
>> <xsl:template match="fi:*" mode="common">
>>   <!-- validation message -->
>>   <xsl:apply-templates select="fi:validation-message"/>
>>   <!-- required mark -->
>>   <xsl:if test="@required='true'">
>>     <!-- something different here-->
>>   </xsl:if>
>> </xsl:template>
>>
>> </xsl:stylesheet>
>
>
> Yes (except for being the wrong template...  the mode="styling" one is 
> correct).
>
> And if copying the template seems undesirable, one might try injecting 
> the attribute... something like:
>
>     <xsl:import href="forms-samples-styling.xsl" />
>
>     <xsl:template match="input" mode="custom-styling">
>         <xsl:param name="required" />
>         <xsl:copy>
>             <xsl:if test="$required='true'">
>                 <xsl:attribute 
> name="class">required-field</xsl:attribute>   <!-- (visual properties 
> belong in CSS) -->
>             </xsl:if>
>         </xsl:copy>
>     </xsl:template>
>
>     <xsl:template match="fi:*" mode="common">
>         <!-- Apply the default transformation -->
>         <xsl:variable name="control">
>             <xsl:apply-imports/>
>         </xsl:variable>
>         <!-- Now apply our styling -->
>         <xsl:apply-templates select="ex:node-set($control)" 
> mode="custom-styling">
>             <xsl:with-param name="required" value="@required" />
>         </xsl:apply-templates>
>     </xsl:template>
>
> You could enhance this to use different styling for a field that took 
> a validation error (add a parameter to the custom-styling template)...
>
> HTH,
> —ml—
>
>
> ---------------------------------------------------------------------
> 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


Re: modifying the style of required widgets in CForms

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jan 18, 2005, at 10:12 AM, Joerg Heinicke wrote:

> On 18.01.2005 13:29, Marc Salvetti wrote:
>> [...snip]
>
> The template for required is a different one:
>
>   <!--+
>       | Common stuff like fi:validation-message, @required.
>       +-->
>   <xsl:template match="fi:*" mode="common">
>     <!-- validation message -->
>     <xsl:apply-templates select="fi:validation-message"/>
>     <!-- required mark -->
>     <xsl:if test="@required='true'">
>       <span class="forms-field-required"> * </span>
>     </xsl:if>
>   </xsl:template>

Nope, Marc got it right :-)... The mode="common" template generates the 
'annotations', not the control itself.

>
>> does someone knows of a good technique to do this (if possible 
>> outside of forms-field-styling.xsl)
>
> Write your own stylesheet, import forms-samples-styling.xsl into it 
> and overload the template for the required attribute.
>
> myforms.xsl:
>
> <xsl:stylesheet>
>
> <xsl:import href="forms-samples-styling.xsl"/>
>
> <xsl:template match="fi:*" mode="common">
>   <!-- validation message -->
>   <xsl:apply-templates select="fi:validation-message"/>
>   <!-- required mark -->
>   <xsl:if test="@required='true'">
>     <!-- something different here-->
>   </xsl:if>
> </xsl:template>
>
> </xsl:stylesheet>

Yes (except for being the wrong template...  the mode="styling" one is 
correct).

And if copying the template seems undesirable, one might try injecting 
the attribute... something like:

	<xsl:import href="forms-samples-styling.xsl" />

	<xsl:template match="input" mode="custom-styling">
		<xsl:param name="required" />
		<xsl:copy>
			<xsl:if test="$required='true'">
				<xsl:attribute name="class">required-field</xsl:attribute>   <!-- 
(visual properties belong in CSS) -->
			</xsl:if>
		</xsl:copy>
	</xsl:template>

	<xsl:template match="fi:*" mode="common">
		<!-- Apply the default transformation -->
		<xsl:variable name="control">
			<xsl:apply-imports/>
		</xsl:variable>
		<!-- Now apply our styling -->
		<xsl:apply-templates select="ex:node-set($control)" 
mode="custom-styling">
			<xsl:with-param name="required" value="@required" />
		</xsl:apply-templates>
	</xsl:template>

You could enhance this to use different styling for a field that took a 
validation error (add a parameter to the custom-styling template)...

HTH,
—ml—


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


Re: modifying the style of required widgets in CForms

Posted by Joerg Heinicke <jo...@gmx.de>.
On 18.01.2005 13:29, Marc Salvetti wrote:
> Hello,
> 
> i've been asked to put a background color on the required fields in 
> cforms, i don't really understand where i need to add the attribute.
> I've been trying to edit forms-field-styling.xsl but
> - I don't like the idea of updating a file coming from the distribution
> - I don't find the right place in the file, i think it should be here 
> but for some reason the attribute isn't added  :
> 
>  <!--+
>      | Handling the common styling. You may only add attributes to the 
> output
>      | in this template as later processing might add attributes too, for
>      | example @checked or @selected
>      +-->
>  <xsl:template match="fi:*" mode="styling">
>   <xsl:apply-templates select="fi:styling/@*" mode="styling"/>
>    <!-- HERE -->
>    <xsl:attribute name="style">backround-color:yellow;</xsl:attribute>

That's probably a caching issue. Try to touch forms-samples-styling.xsl.

>    <!--+
>        | @listbox-size needs to be handled separately as even if it is not
>        | specified some output (@size) must be generated.
>        +-->
>    <xsl:if test="self::fi:field[fi:selection-list][fi:styling/@list-type 
> = 'listbox'] or
>                  self::fi:multivaluefield[not(fi:styling/@list-type = 
> 'checkbox')]">
>      <xsl:variable name="size">
>        <xsl:value-of select="fi:styling/@listbox-size"/>
>        <xsl:if test="not(fi:styling/@listbox-size)">5</xsl:if>
>      </xsl:variable>
>      <xsl:attribute name="size">
>        <xsl:value-of select="$size"/>
>      </xsl:attribute>
>    </xsl:if>
>  </xsl:template>

The template for required is a different one:

   <!--+
       | Common stuff like fi:validation-message, @required.
       +-->
   <xsl:template match="fi:*" mode="common">
     <!-- validation message -->
     <xsl:apply-templates select="fi:validation-message"/>
     <!-- required mark -->
     <xsl:if test="@required='true'">
       <span class="forms-field-required"> * </span>
     </xsl:if>
   </xsl:template>

> does someone knows of a good technique to do this (if possible outside 
> of forms-field-styling.xsl)

Write your own stylesheet, import forms-samples-styling.xsl into it and 
overload the template for the required attribute.

myforms.xsl:

<xsl:stylesheet>

<xsl:import href="forms-samples-styling.xsl"/>

<xsl:template match="fi:*" mode="common">
   <!-- validation message -->
   <xsl:apply-templates select="fi:validation-message"/>
   <!-- required mark -->
   <xsl:if test="@required='true'">
     <!-- something different here-->
   </xsl:if>
</xsl:template>

</xsl:stylesheet>

Joerg

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