<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method = "text"/>
<xsl:template match="form-config">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <xsl:for-each select="var">
field[<xsl:number format="1"/>] = Array(
  '<xsl:value-of select="@name"/>',             <!-- name of data field  -->
  '<xsl:value-of select="@type"/>',             <!-- type of field being displayed  -->
  '<xsl:value-of select="description"/>',       <!-- description of field  -->
  <xsl:value-of select="validation-regexp"/>,   <!-- data validation regular expression  -->
  '<xsl:value-of select="validation-message"/>',<!-- message to display when data is invalid  -->
  <xsl:choose>
    <xsl:when test='@type="text"'>'1'</xsl:when>
    <xsl:when test='@type="textarea"'>'1'</xsl:when>
    <xsl:otherwise>'<xsl:value-of select = "count(option)" />'</xsl:otherwise>
  </xsl:choose>
);       
    </xsl:for-each>
</SCRIPT>
</xsl:template>
</xsl:stylesheet>
 
  |