PHP Classes

File: formDef.xsl

Recommend this page to a friend!
  Classes of yo keller   metaForm   formDef.xsl   Download  
File: formDef.xsl
Role: Auxiliary data
Content type: text/plain
Description: xsl style sheet for numerous form sub-fields defined as xml configurations
Class: metaForm
Generate and validate forms from XML definitions
Author: By
Last change: improved handling of hidden and select form input fields
Date: 19 years ago
Size: 29,386 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"/> <!-- THIS FILE DESCRIBES THE STYLES TO BE EDITED THE TAG NAMES SHOULD BE FAIRLY SELF EXPLANATORY FORM TYPES SUPPORTED: TEXT: Text input field TEXTAREA: Textarea input field SELECT: Selection list MULTISELECT: Multiple selection list CHECKBOX: Checkboxes RADIO: Radio buttons FILE: File input field SELECT-FILE: Selection list kept in a file MULTISELECT-FILE: Multiple selection list kept in a file HIDDEN: hidden input field + no data display (no data entry) CMT: hidden input field + data display (no data entry) BUTTON: action button, separate from submit buttons(s) ENV: hidden input field + data display (no data entry) of an ENV variable listed in either Env-list.txt or Server-list.txt DATE: date input field in form dd/mo/yyyy hh:mn:ss DATE_jjmmaa: date input field in form dd/mo/yyyy EMAIL: email adress, which when clicked generate a message (should be extended to a func which sends the form as email content) OBJECT: uri and (dis-)play, of an object OBJECT-CLASS: uri and (dis-)play, of an object having a classid, e.g. an animation HT_LINK: uri as ht-link META-TEXT: Text input field whose {xxx} expressions represents the correponding var values DISP-QRY: display of the result of a specific query identified by a mkformgen qry nbr and various context info (database, etc.) --> <!-- ###### THIS form-element TEMPLATE DOES NOT NORMALLY NEED TO BE EDITED --> <xsl:template name="form-element"> <xsl:choose> <xsl:when test='@type="text" or @type="email" or @type="object" or @type="object-class" or @type="ht_link" or @type="meta-text" '> <!-- TEXT FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each > <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> <xsl:attribute name="onkeyup"> <xsl:text>doProcessText(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> <div> <xsl:choose> <xsl:when test='@type="email"'> <a> <xsl:attribute name="href">mailto:<xsl:value-of select="value"/>?subject=<xsl:value-of select="description"/> </xsl:attribute> <xsl:value-of select="value"/> </a> </xsl:when> <xsl:when test='@type="object"'> <OBJECT> <xsl:attribute name="data"><xsl:value-of select="value"/></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="description"/></xsl:attribute> </OBJECT> </xsl:when> <xsl:when test='@type="object-class"'> <OBJECT> <xsl:attribute name="classid"><xsl:value-of select="value"/></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="description"/></xsl:attribute> </OBJECT> </xsl:when> <xsl:when test='@type="ht_link"'> <a> <xsl:attribute name="href"><xsl:value-of select="value"/></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="description"/> </xsl:attribute> <xsl:value-of select="value"/> </a> </xsl:when> <xsl:when test='@type="meta-text"'> <span> <xsl:attribute name="id">meta_<xsl:value-of select="@name"/></xsl:attribute> </span> <input> <xsl:attribute name="type">button</xsl:attribute> <xsl:attribute name="value">voir</xsl:attribute> <xsl:attribute name="onmouseover"> <xsl:text>interp_xp(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> </xsl:when> </xsl:choose> </div> </xsl:when> <xsl:when test='@type="date_jjmmaa" or @type="date"'> <!-- DATE FIELD --> <input> <!-- day FIELD: j like jour--> <xsl:attribute name="name">j_<xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="size">2</xsl:attribute> <xsl:attribute name="onChange"> <xsl:text>javascript:upd_time(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> <input> <!-- month FIELD: m like mois--> <xsl:attribute name="name">m_<xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="size">2</xsl:attribute> <xsl:attribute name="onChange"> <xsl:text>javascript:upd_time(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> <input> <!-- year FIELD: y like year--> <xsl:attribute name="name">y_<xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="size">4</xsl:attribute> <xsl:attribute name="onChange"> <xsl:text>javascript:upd_time(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> <xsl:if test='@type="date"'> <!-- add hh:mn:ss FIELDS --> <xsl:text> : </xsl:text> <input> <!-- hours FIELD: h --> <xsl:attribute name="name">h_<xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="size">2</xsl:attribute> <xsl:attribute name="onChange"> <xsl:text>javascript:upd_time(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> <input> <!-- minutes FIELD: mn --> <xsl:attribute name="name">mn_<xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="size">2</xsl:attribute> <xsl:attribute name="onChange"> <xsl:text>javascript:upd_time(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> <input> <!-- seconds FIELD: s --> <xsl:attribute name="name">s_<xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="size">2</xsl:attribute> <xsl:attribute name="onChange"> <xsl:text>javascript:upd_time(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> </xsl:if> <input> <!-- today button FIELD: --> <xsl:attribute name="type">button</xsl:attribute> <xsl:attribute name="value">aujourd'hui</xsl:attribute> <xsl:attribute name="onmousedown"> <xsl:text>javascript:install_date(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> <input> <!-- unknwon date button FIELD: --> <xsl:attribute name="type">button</xsl:attribute> <xsl:attribute name="value">date inconnue</xsl:attribute> <xsl:attribute name="onmousedown"> <xsl:text>javascript:unknown_date(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </xsl:attribute> </input> <div> <!-- date display FIELD: --> <xsl:attribute name="id">jjmmaa_<xsl:value-of select="@name"/></xsl:attribute> </div> <input> <!-- hidden date value FIELD: --> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each > <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> </xsl:when> <xsl:when test='@type="cmt"'> <!-- COMMENT FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> <div> <xsl:apply-templates select=".//root"/> <xsl:value-of select="value"/> </div> </xsl:when> <xsl:when test='@type="disp-qry"'> <!-- COMMENT FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> <div> <xsl:apply-templates select=".//root"/> </div> </xsl:when> <xsl:when test='@type="hidden"'> <!-- HIDDEN FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> </xsl:when> <xsl:when test='@type="env"'> <!-- ENV FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> <div> <xsl:value-of select="value"/> </div> </xsl:when> <xsl:when test='@type="button"'> <!-- BUTTON FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <!--xsl:attribute name="value"><xsl:value-of select="description"/></xsl:attribute--> <xsl:attribute name="value"><xsl:value-of select="validation-message"/></xsl:attribute> <xsl:attribute name="onmousedown"><xsl:value-of select="act"/></xsl:attribute> </input> </xsl:when> <xsl:when test='@type="textarea"'> <!-- TEXTAREA FIELD --> <textarea> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each > <xsl:value-of select="value"/> </textarea> </xsl:when> <xsl:when test='@type="select" or @type="select-file"'> <!-- SINGLE SELECT FIELD --> <xsl:variable name="default"><xsl:value-of select="value"/></xsl:variable> <xsl:variable name="sname"><xsl:value-of select="@name"/></xsl:variable> <select> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="onclick">chk(this);</xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each > <xsl:for-each select="option" > <option> <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute> <xsl:attribute name="onclick">chk(this);</xsl:attribute> <!-- function chk(obj) defined in formValidated.js --> <xsl:if test="$default=@value"> <xsl:attribute name="selected">yes</xsl:attribute> </xsl:if> <xsl:value-of select="."/> </option> </xsl:for-each> </select> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/><xsl:text>_opt</xsl:text></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="option[@value=$default]"/></xsl:attribute> </input> </xsl:when> <xsl:when test='@type="multiselect" or @type="multiselect-file"'> <!-- MULTIPLE SELECT FIELD --> <select> <xsl:attribute name="name"><xsl:value-of select="@name"/>[]</xsl:attribute> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="multiple">yes</xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each > <xsl:for-each select="option" > <option> <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute> <xsl:variable name="value"><xsl:value-of select="@value"/></xsl:variable> <xsl:for-each select="../value"> <!-- CAN HAVE MULTIPLE VALUES --> <xsl:if test=".=$value"> <xsl:attribute name="selected">yes</xsl:attribute> </xsl:if> </xsl:for-each> <xsl:value-of select="."/> </option> </xsl:for-each > </select> </xsl:when> <xsl:when test='@type="checkbox"'> <!-- CHECKBOX FIELD --> <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable> <!-- NAME OF FIELD --> <xsl:for-each select="option" > <xsl:variable name="value"><xsl:value-of select="@value"/></xsl:variable> <!-- VALUE OF FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="$name"/>[<xsl:number format="0"/>]</xsl:attribute> <xsl:attribute name="type">checkbox</xsl:attribute> <xsl:for-each select="../html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each > <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute> <xsl:for-each select="../value"> <!-- CAN HAVE MULTIPLE VALUES --> <xsl:if test=".=$value"> <xsl:attribute name="checked">yes</xsl:attribute> </xsl:if> </xsl:for-each> <xsl:value-of select="."/> </input> </xsl:for-each > </xsl:when> <xsl:when test='@type="radio"'> <!-- RADIO BUTTON FIELD --> <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable> <!-- NAME OF FIELD --> <xsl:variable name="default"><xsl:value-of select="value"/></xsl:variable> <xsl:for-each select="option"> <input> <xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute> <xsl:attribute name="type">radio</xsl:attribute> <xsl:for-each select="../html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute> <xsl:if test="$default=@value"> <xsl:attribute name="checked">yes</xsl:attribute> </xsl:if> <xsl:value-of select="."/> </input> </xsl:for-each> </xsl:when> <xsl:when test='@type="file"'> <!-- FILE FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/><xsl:text>_hide</xsl:text></xsl:attribute> <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="onchange"><xsl:text>this.form.elements['</xsl:text> <xsl:value-of select="@name"/> <xsl:text>'].value = this.form.elements['</xsl:text> <xsl:value-of select="@name"/><xsl:text>_hide</xsl:text> <xsl:text>'].value;</xsl:text></xsl:attribute> </input> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> </input> <div> <xsl:value-of select="value"/> </div> </xsl:when> </xsl:choose> </xsl:template> <!-- ###### THIS display-element TEMPLATE DOES NOT NORMALLY NEED TO BE EDITED --> <xsl:template name="display-element"> <xsl:choose> <xsl:when test='@type="text" or @type="cmt" or @type="disp-qry" or @type="env"'> <!-- TEXT FIELD or COMMENT --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> <div> <xsl:choose> <xsl:when test='@type="disp-qry"'> <xsl:apply-templates select=".//root"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="value"/> <xsl:apply-templates select=".//root"/> </xsl:otherwise> </xsl:choose> </div> </xsl:when> <xsl:when test='@type="email" or @type="object" or @type="object-class" or @type="ht_link" or @type="meta-text"'> <!-- EMAIL FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> <div> <xsl:choose> <xsl:when test='@type="email"'> <a> <xsl:attribute name="href">mailto:<xsl:value-of select="value"/>?subject=<xsl:value-of select="description"/> </xsl:attribute> <xsl:value-of select="value"/> </a> </xsl:when> <xsl:when test='@type="object"'> <OBJECT> <xsl:attribute name="data"><xsl:value-of select="value"/></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="description"/></xsl:attribute> </OBJECT> </xsl:when> <xsl:when test='@type="object-class"'> <OBJECT> <xsl:attribute name="classid"><xsl:value-of select="value"/></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="description"/></xsl:attribute> </OBJECT> </xsl:when> <xsl:when test='@type="ht_link"'> <a> <xsl:attribute name="href"><xsl:value-of select="value"/></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="description"/> </xsl:attribute> <xsl:value-of select="value"/> </a> </xsl:when> <xsl:when test='@type="meta-text"'> <span> <xsl:attribute name="id">meta_<xsl:value-of select="@name"/></xsl:attribute> </span> <script> <xsl:text>interp_xp(this.form,'</xsl:text> <xsl:value-of select="@name"/> <xsl:text>');</xsl:text> </script> </xsl:when> </xsl:choose> </div> </xsl:when> <xsl:when test='@type="hidden"'> <!-- HIDDEN FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> </xsl:when> <xsl:when test='@type="date_jjmmaa" or @type="date"'> <!-- DATE FIELDS --> <div> <!-- date display FIELD: --> <xsl:attribute name="id">jjmmaa_<xsl:value-of select="@name"/></xsl:attribute> </div> <input> <!-- hidden date value FIELD: --> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each > <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> </input> </xsl:when> <xsl:when test='@type="textarea"'> <!-- TEXTAREA FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> </input> <div> <xsl:value-of select="value"/> </div> </xsl:when> <xsl:when test='@type="file"'> <!-- FILE FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> </input> <div> <xsl:value-of select="value"/> </div> </xsl:when> <xsl:when test='@type="select" or @type="select-file"'> <!-- SINGLE SELECT FIELD --> <xsl:variable name="default"><xsl:value-of select="value"/></xsl:variable> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="$default"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> </input> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/><xsl:text>_opt</xsl:text></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="option[@value=$default]"/></xsl:attribute> </input> <div> <!--xsl:value-of select="value"/--> <xsl:value-of select="option[@value=$default]"/> </div> </xsl:when> <xsl:when test='@type="multiselect" or @type="multiselect-file"'> <!-- MULTIPLE SELECT FIELD --> <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable> <!-- NAME OF FIELD --> <xsl:variable name="ps_type"><xsl:value-of select="@type"/></xsl:variable> <xsl:for-each select="option" ><!-- CAN HAVE MULTIPLE VALUES --> <xsl:variable name="value"><xsl:value-of select="@value"/></xsl:variable> <!-- VALUE OF FIELD --> <xsl:for-each select="../value"> <xsl:if test=".=$value"> <input> <xsl:attribute name="name"><xsl:value-of select="$name"/>[<xsl:number format="0"/>]</xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="$ps_type"/></xsl:attribute> <xsl:for-each select="../html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:attribute name="value"><xsl:value-of select="$value"/></xsl:attribute> <xsl:attribute name="selected">yes</xsl:attribute> </input> </xsl:if> </xsl:for-each> </xsl:for-each> <xsl:for-each select="value"> </xsl:for-each> <xsl:call-template name="value-option"/> <!--xsl:call-template name="value-element"/--> </xsl:when> <xsl:when test='@type="checkbox"'> <!-- CHECKBOX FIELD --> <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable> <!-- NAME OF FIELD --> <xsl:for-each select="option" > <xsl:variable name="value"><xsl:value-of select="@value"/></xsl:variable> <!-- VALUE OF FIELD --> <input> <xsl:attribute name="name"><xsl:value-of select="$name"/>[<xsl:number format="0"/>]</xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type">checkbox</xsl:attribute> <xsl:for-each select="../html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> <xsl:for-each select="../value"> <!-- CAN HAVE MULTIPLE VALUES --> <xsl:if test=".=$value"> <xsl:attribute name="value"><xsl:value-of select="$value"/></xsl:attribute> <xsl:attribute name="checked">yes</xsl:attribute> </xsl:if> </xsl:for-each> </input> </xsl:for-each> <xsl:call-template name="value-element"/> </xsl:when> <xsl:when test='@type="radio"'> <!-- RADIO BUTTON FIELD --> <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable> <!-- NAME OF FIELD --> <xsl:variable name="default"><xsl:value-of select="value"/></xsl:variable> <input> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">hidden</xsl:attribute> <xsl:attribute name="ps_type"><xsl:value-of select="@type"/></xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> <xsl:for-each select="html-display-option"> <xsl:attribute name="{@name}"><xsl:value-of select="@value"/></xsl:attribute> </xsl:for-each> </input> <div> <xsl:value-of select="value"/> </div> </xsl:when> </xsl:choose> </xsl:template> <xsl:template name="value-element"> <xsl:for-each select="value"> <div> <xsl:value-of select="."/> </div> </xsl:for-each> </xsl:template> <xsl:template name="value-option"> <xsl:for-each select="value"> <xsl:variable name="v"><xsl:value-of select="."/></xsl:variable> <div> <xsl:value-of select="../option[@value=$v]"/> </div> </xsl:for-each> </xsl:template> </xsl:stylesheet>