bruno 2003/11/14 01:46:05
Modified: src/blocks/woody/samples/resources woody-field-styling.xsl
Log:
* Added wi:validation-errors template (contributed by David Carmona Perez)
* Added template to style messages widget
Revision Changes Path
1.10 +49 -0
cocoon-2.1/src/blocks/woody/samples/resources/woody-field-styling.xsl
Index: woody-field-styling.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-field-styling.xsl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- woody-field-styling.xsl 13 Nov 2003 14:57:06 -0000 1.9
+++ woody-field-styling.xsl 14 Nov 2003 09:46:05 -0000 1.10
@@ -407,6 +407,55 @@
<xsl:call-template name="woody-field-common"/>
</xsl:template>
+ <xsl:template match="wi:messages">
+ <xsl:if test="wi:message">
+ <xsl:apply-templates select="wi:label"/>:
+ <ul>
+ <xsl:for-each select="wi:message">
+ <li><xsl:apply-templates/></li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="wi:validation-errors">
+ <xsl:variable name="header">
+ <xsl:choose>
+ <xsl:when test="header">
+ <xsl:copy-of select="header"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <p class="validation-errors">The following errors have been
detected (marked with !):</p>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="footer">
+ <xsl:choose>
+ <xsl:when test="footer">
+ <xsl:copy-of select="footer"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <p class="validation-errors">Please, correct them and re-submit
the form.</p>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="frm" select="ancestor::wi:form-template"/>
+ <xsl:if test="$frm and $frm//wi:validation-message">
+ <xsl:copy-of select="$header"/>
+ <ul>
+ <xsl:for-each select="$frm//wi:validation-message">
+ <li class="validation-error">
+ <xsl:if test="../wi:label">
+ <xsl:value-of select="../wi:label"/><xsl:text>: </xsl:text>
+ </xsl:if>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ <xsl:copy-of select="$footer"/>
+ </xsl:if>
+ </xsl:template>
+
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>