cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java form-validator.xsl
Date Thu, 19 Jul 2001 19:40:06 GMT
bloritsch    01/07/19 12:40:06

  Modified:    src/org/apache/cocoon/components/language/markup/xsp/java
                        form-validator.xsl
  Log:
  Add "on-xxxx" processing.  This allows you to do this:
  <xsp-formval:on-toolarge name="foo">
    <p>Foo was too large.  It should be less than 64 characters</p>
  </xsp-formval:on-error>
  
  Revision  Changes    Path
  1.4       +248 -5    xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/form-validator.xsl
  
  Index: form-validator.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/form-validator.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- form-validator.xsl	2001/07/10 17:04:08	1.3
  +++ form-validator.xsl	2001/07/19 19:40:06	1.4
  @@ -1,5 +1,5 @@
   <?xml version="1.0" encoding="ISO-8859-1"?><!-- -*- xsl -*- -->
  -<!-- $Id: form-validator.xsl,v 1.3 2001/07/10 17:04:08 haul Exp $ -->
  +<!-- $Id: form-validator.xsl,v 1.4 2001/07/19 19:40:06 bloritsch Exp $ -->
   <!--
   
    ============================================================================
  @@ -52,7 +52,7 @@
   -->
   <!--
    * @author <a href="mailto:haul@informatik.tu-darmstadt.de>Christian Haul</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2001/07/10 17:04:08 $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/07/19 19:40:06 $
   -->
   
   <!-- XSP Form-Validator logicsheet for the Java language -->
  @@ -189,6 +189,39 @@
     </xsl:template>
   
     <xspdoc:desc>
  +    Only displays the enclosed markup if the validation of this
  +    parameter was successful.
  +
  +    Two usage alternatives:
  +    1) standalone, specify parameter name
  +    2) within a xsp-formval:validate context (no parameter name necessary)
  +  </xspdoc:desc>
  +  <xsl:template match="xsp-formval:on-ok">
  +    <xsl:variable name="name">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="name">name</xsl:with-param>
  +        <xsl:with-param name="default">-1</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:choose>
  +      <xsl:when test="string($name)!='-1'">
  +        <xsp:logic>
  +          if (XSPFormValidatorHelper.getParamResult(objectModel,<xsl:copy-of select="$name"/>).equals(ValidatorActionResult.OK))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsp:logic>
  +          if (__formval_fvh.getParamResult(objectModel).equals(ValidatorActionResult.OK))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xspdoc:desc>
       Returns a boolean whether validation of this parameter returned
       a "Too Small" error. See javadoc of
       <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  @@ -216,6 +249,41 @@
     </xsl:template>
   
     <xspdoc:desc>
  +    Only displays the enclosed markup if the validation of this
  +    parameter returned a "Too Small" error. See javadoc of
  +    <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  +    detailed meaning.
  +
  +    Two usage alternatives:
  +    1) standalone, specify parameter name
  +    2) within a xsp-formval:validate context (no parameter name necessary)
  +  </xspdoc:desc>
  +  <xsl:template match="xsp-formval:on-toosmall">
  +    <xsl:variable name="name">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="name">name</xsl:with-param>
  +        <xsl:with-param name="default">-1</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:choose>
  +      <xsl:when test="string($name)!='-1'">
  +        <xsp:logic>
  +          if (XSPFormValidatorHelper.getParamResult(objectModel,<xsl:copy-of select="$name"/>).equals(ValidatorActionResult.TOOSMALL))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsp:logic>
  +          if (__formval_fvh.getParamResult(objectModel).equals(ValidatorActionResult.TOOSMALL))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xspdoc:desc>
       Returns a boolean whether validation of this parameter returned
       an error (ERROR or above). See javadoc of
       <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  @@ -243,6 +311,41 @@
     </xsl:template>
   
     <xspdoc:desc>
  +    Only displays the enclosed markup if the validation of this
  +    parameter returned an error (ERROR or above). See javadoc of
  +    <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  +    detailed meaning.
  +
  +    Two usage alternatives:
  +    1) standalone, specify parameter name
  +    2) within a xsp-formval:validate context (no parameter name necessary)
  +  </xspdoc:desc>
  +  <xsl:template match="xsp-formval:on-error">
  +    <xsl:variable name="name">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="name">name</xsl:with-param>
  +        <xsl:with-param name="default">-1</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:choose>
  +      <xsl:when test="string($name)!='-1'">
  +        <xsp:logic>
  +          if (XSPFormValidatorHelper.getParamResult(objectModel,<xsl:copy-of select="$name"/>).ge(ValidatorActionResult.ERROR))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsp:logic>
  +          if (__formval_fvh.getParamResult(objectModel).ge(ValidatorActionResult.ERROR))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xspdoc:desc>
       Returns a boolean whether validation of this parameter returned
       an "Too Large" error. See javadoc of
       <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  @@ -270,6 +373,41 @@
     </xsl:template>
   
     <xspdoc:desc>
  +    Only displays the enclosed markup if the validation of this
  +    parameter returned a "Too Large" error. See javadoc of
  +    <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  +    detailed meaning.
  +
  +    Two usage alternatives:
  +    1) standalone, specify parameter name
  +    2) within a xsp-formval:validate context (no parameter name necessary)
  +  </xspdoc:desc>
  +  <xsl:template match="xsp-formval:on-toolarge">
  +    <xsl:variable name="name">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="name">name</xsl:with-param>
  +        <xsl:with-param name="default">-1</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:choose>
  +      <xsl:when test="string($name)!='-1'">
  +        <xsp:logic>
  +          if (XSPFormValidatorHelper.getParamResult(objectModel,<xsl:copy-of select="$name"/>).equals(ValidatorActionResult.TOOLARGE))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsp:logic>
  +          if (__formval_fvh.getParamResult(objectModel).equals(ValidatorActionResult.TOOLARGE))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xspdoc:desc>
       Returns a boolean whether validation of this parameter returned
       an "No Match" error. See javadoc of
       <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  @@ -297,6 +435,41 @@
     </xsl:template>
   
     <xspdoc:desc>
  +    Only displays the enclosed markup if the validation of this
  +    parameter returned a "No Match" error. See javadoc of
  +    <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  +    detailed meaning.
  +
  +    Two usage alternatives:
  +    1) standalone, specify parameter name
  +    2) within a xsp-formval:validate context (no parameter name necessary)
  +  </xspdoc:desc>
  +  <xsl:template match="xsp-formval:on-nomatch">
  +    <xsl:variable name="name">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="name">name</xsl:with-param>
  +        <xsl:with-param name="default">-1</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:choose>
  +      <xsl:when test="string($name)!='-1'">
  +        <xsp:logic>
  +          if (XSPFormValidatorHelper.getParamResult(objectModel,<xsl:copy-of select="$name"/>).equals(ValidatorActionResult.NOMATCH))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsp:logic>
  +          if (__formval_fvh.getParamResult(objectModel).equals(ValidatorActionResult.NOMATCH))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xspdoc:desc>
       Returns a boolean whether validation of this parameter returned
       an "Is Null" error. See javadoc of
       <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  @@ -324,6 +497,41 @@
     </xsl:template>
   
     <xspdoc:desc>
  +    Only displays the enclosed markup if the validation of this
  +    parameter returned an "Is Null" error. See javadoc of
  +    <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  +    detailed meaning.
  +
  +    Two usage alternatives:
  +    1) standalone, specify parameter name
  +    2) within a xsp-formval:validate context (no parameter name necessary)
  +  </xspdoc:desc>
  +  <xsl:template match="xsp-formval:on-null">
  +    <xsl:variable name="name">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="name">name</xsl:with-param>
  +        <xsl:with-param name="default">-1</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:choose>
  +      <xsl:when test="string($name)!='-1'">
  +        <xsp:logic>
  +          if (XSPFormValidatorHelper.getParamResult(objectModel,<xsl:copy-of select="$name"/>).equals(ValidatorActionResult.ISNULL))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsp:logic>
  +          if (__formval_fvh.getParamResult(objectModel).equals(ValidatorActionResult.ISNULL))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xspdoc:desc>
       Returns a boolean whether validation of this parameter returned
       an "Not Present" error. See javadoc of
       <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  @@ -351,6 +559,41 @@
     </xsl:template>
   
     <xspdoc:desc>
  +    Only displays the enclosed markup if the validation of this
  +    parameter returned a "Not Present" error. See javadoc of
  +    <code>org.apache.cocoon.acting.ValidationActionResult</code> for
  +    detailed meaning.
  +
  +    Two usage alternatives:
  +    1) standalone, specify parameter name
  +    2) within a xsp-formval:validate context (no parameter name necessary)
  +  </xspdoc:desc>
  +  <xsl:template match="xsp-formval:on-notpresent">
  +    <xsl:variable name="name">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="name">name</xsl:with-param>
  +        <xsl:with-param name="default">-1</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:choose>
  +      <xsl:when test="string($name)!='-1'">
  +        <xsp:logic>
  +          if (XSPFormValidatorHelper.getParamResult(objectModel,<xsl:copy-of select="$name"/>).equals(ValidatorActionResult.NOTPRESENT))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsp:logic>
  +          if (__formval_fvh.getParamResult(objectModel).equals(ValidatorActionResult.NOTPRESENT))
{
  +              <xsl:apply-templates/>
  +          }
  +        </xsp:logic>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xspdoc:desc>
       Retrieve any attribute from a parameter's declaration in the
       descriptor file with respect to parameter or the current
       constraint-set decalarations.
  @@ -441,11 +684,11 @@
     <xsl:template name="get-nested-content">
       <xsl:param name="content"/>
       <xsl:choose>
  -      <xsl:when test="$content/*"> 
  +      <xsl:when test="$content/*">
         <xsl:apply-templates select="$content/*|$content/text()"/>
         </xsl:when>
         <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
  -    </xsl:choose> 
  +    </xsl:choose>
     </xsl:template>
   
     <xsl:template name="error">
  @@ -454,7 +697,7 @@
     </xsl:template>
   
     <!-- Default: match all -->
  -  
  +
     <xsl:template match="@*|node()" priority="-1">
       <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message