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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
