Login   Register  
PHP Classes
elePHPant
Icontem

File: jsrs-adr-php/jsrs-adr_Conf.xsl

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of yo keller  >  metaForm  >  jsrs-adr-php/jsrs-adr_Conf.xsl  >  Download  
File: jsrs-adr-php/jsrs-adr_Conf.xsl
Role: Auxiliary data
Content type: text/plain
Description: form xsl configuration file
Class: metaForm
Generate and validate forms from XML definitions
Author: By
Last change:
Date: 2005-03-15 13:24
Size: 3,490 bytes
 

Contents

Class file image Download
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

<xsl:variable name = "act" >
<xsl:choose>
<xsl:when test='count(//formAction/act)>0'><xsl:value-of select="//formAction/act"/></xsl:when>
<xsl:otherwise>none</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<!-- ###### EDIT THIS TEMPLATE TO CUSTOMISE THE FORM  -->
<xsl:template match="form-config">
  <div><h2><xsl:text>act :</xsl:text><xsl:value-of select ="$act" /></h2></div>
  <xsl:choose>

  <!-- ###### form-element  -->
  <xsl:when test="$act='check data' or $act='cancel' or $act='none'or $act='edit'">
  <form name='inputForm' enctype="multipart/form-data" method='post'>
  <table cellspacing="0" border="1">
    <xsl:for-each select="var">
      <tr>
        <td><xsl:value-of select="description"/></td>
        <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
        <td><xsl:call-template name="form-element"/></td>
        <td>
          <xsl:choose>
            <xsl:when test="validation-error">
              <xsl:attribute name="class">formError</xsl:attribute>
              <xsl:value-of select="validation-message"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </td>
      </tr>
    </xsl:for-each>
  <tr>
    <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
    <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
    <td>
      <input type="submit" value="check data"     name="formAction"/>
      <input type="submit" value="cancel" name="formAction"/>
      <input type="submit" value="display"  name="formAction"/>
    </td>
    <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
  </tr>
  </table>
 </form>
 </xsl:when>

  <!-- ###### display-element  -->
  <xsl:when test="$act='display' ">
  <form name='inputForm' onSubmit='return validate()' enctype="multipart/form-data" method='post'>
  <table cellspacing="0" border="1">
    <xsl:for-each select="var">
      <xsl:if test="@type!='hidden'">
      <tr>
        <td><xsl:value-of select="description"/></td>
        <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
        <td><xsl:call-template name="display-element"/></td>
        <td>
          <xsl:choose>
            <xsl:when test="validation-error">
              <xsl:attribute name="class">formError</xsl:attribute>
              <xsl:value-of select="validation-message"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </td>
      </tr>
      </xsl:if>
    </xsl:for-each>
  <tr>
    <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
    <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
    <td>
      <input type="submit" value="edit"     name="formAction"/>
      <input type="submit" value="cancel" name="formAction"/>
    </td>
    <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
  </tr>
  </table>
 </form>
 </xsl:when>
 <xsl:otherwise>
 </xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:include href="formDef.xsl"/>
</xsl:stylesheet>