:: If find myself doing the following so that I don't have to 
:: style or design inside of xsp's much and just leave the 
:: styling and reorganizing to xsl .... (with validation error 
:: codes too).  Anyway there's allways a million ways ....

This example is really nice, 

but is more an example of an complex xslt and not a generic markup ->
form solution.

But i like it !

Has anybody an idea how to develop a more general/generic xslt (with
template parameters for example),
so it would nicely display form errors for any form ? I mean the
'payment' stuff etc could be substituted
with general variables/parameters.

Murat

:: 
:: <xsl:template match="form[@name='payment']">
::   <xsl:if test=".//error">
::     <div class="form_errors">
::       <ul>
::         <xsl:if test=".//error[text()='missing']">
::           <li>Please complete any required fields.</li>
::         </xsl:if>
::         <xsl:for-each select=".//error[text() != 'missing']">
::           <li><xsl:apply-templates select="."/></li>
::         </xsl:for-each>
::       </ul>
::     </div>
::   </xsl:if>
::   <form name="{@name}" action="{@action}" method="{@method}" 
:: enctype="{@enctype}">
::     <xsl:apply-templates select="hidden"/>
::     <xsl:apply-templates 
:: select="submit_button[name='send_payment']"/>
::     <xsl:apply-templates select="payment"/>
::   </form>
:: </xsl:template>
:: 
:: <xsl:template match="form[@name='payment']/payment">
::   <div class="payment">
::     <xsl:apply-templates select="textfield[name='cc_number']"/>
::     <xsl:apply-templates 
:: select="single_select[name='cc_exp_month']"/>
::     <xsl:apply-templates select="single_select[name='cc_exp_year']"/>
::   </div>
:: </xsl:template>
:: 
:: <xsl:template match="form">
::   <xsl:message>Unknown form: '<xsl:value-of 
:: select="@name"/>'</xsl:message>
::   <xsl:copy>
::     <xsl:copy-of select="@*"/>
::     <xsl:apply-templates/>
::   </xsl:copy>
:: </xsl:template>
:: 
:: <xsl:template match="error">
::   <xsl:message>Unknown error: '<xsl:value-of 
:: select="name(parent::node())"/>' =  '<xsl:value-of 
:: select="."/>'</xsl:message>
::   <xsl:text>(unknown error):  
:: </xsl:text><xsl:apply-templates/> </xsl:template>
:: 
:: <xsl:template 
:: match="textfield[name='cc_number']/error[text()='invalid']">
::   <xsl:text>Please Check your Credit Card Number and try 
:: again.</xsl:text> </xsl:template>
:: 
:: <xsl:template 
:: match="textfield[name='cc_exp_month']/error[text()='expired']">
::   <xsl:text>Your Credit Card is Expired</xsl:text> </xsl:template>
:: 
:: <xsl:template 
:: match="textfield[name='cc_exp_year']/error[text()='expired']">
:: <!-- noop -->
:: </xsl:template>
:: 
:: ---------------------------------------------------------------------
:: To unsubscribe, e-mail: [EMAIL PROTECTED]
:: For additional commands, e-mail: [EMAIL PROTECTED]
:: 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to