[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Input forms / XSL

  • From: "Michael O' Dell" <maod@h...>
  • To: xml-dev@x...
  • Date: Wed, 31 May 2000 12:01:15 GMT

xsl forms
Hey everybody,

I'm currently trying to develop a 'generic' structure for input forms, i.e. 
text boxes, check boxes, radio buttons etc. Furthermore, I'm trying to 
implement this in a table structure, which has three columns per row, i.e. 
<TR> <TD></TD> <TD></TD> <TD></TD> </TR>. The first <TD></TD> is used to ask 
the user a question. The remaining <TD></TD>*2 are used to gather 
information from the user. Implementing my structure works fine for all 
areas except for the following:
     When I use the remaining <TD></TD> & <TD></TD> for radio buttons, I am 
unable to gather a unique 'name' attribute for the HTML (INPUT) output.

Here is a sample of my XML:

<INPUTFORM>
	<FIELD ID="ENTER DB FIELD HERE" name="Citizen_1" type="Radio">
		<LABEL>staatsburger?</LABEL>
		<INPUTFIELD>
			<BUTTON>ja</BUTTON>
			<BUTTON>nee</BUTTON>
		</INPUTFIELD>
	</FIELD>
</INPUTFORM>
<!--
<INPUTFORM>
	<FIELD ID="ENTER DB FIELD HERE" name="Citizen_2" type="Radio">
		<INPUTFIELD name="Citizen_2">
			<BUTTON>ja</BUTTON>
			<BUTTON>nee</BUTTON>
		</INPUTFIELD>
	</FIELD>
</INPUTFORM>
-->

(When I include the second <INPUTFORM> etc., I get an additional line in my 
output HTML. Hence the comment)

Here is my XSL that transforms this to an HTML output:

<TD>
   <xsl:choose>
      <xsl:when test="@type='Radio'">
         <xsl:variable name="file">
            <xsl:value-of select="@name" />
         </xsl:variable>
         <xsl:for-each select="INPUTFIELD/BUTTON">
            <INPUT type="radio" name="{$file}" value="ja">								           
                    <xsl:apply-templates />
	    </INPUT>
	 </xsl:for-each>
      </xsl:when>
      <xsl:when test="@type='Check'">
         <xsl:variable name="file">
  	    <xsl:value-of select="@name" />
	 </xsl:variable>
	 <xsl:for-each select="INPUTFIELD">
            <INPUT type="checkbox" name="{$file}" value="????">
	       <xsl:apply-templates />
	    </INPUT>
          </xsl:for-each>
      </xsl:when>
      <xsl:when test="@type='Text'">
         <INPUT type="text" name="1" size="20" maxlength="40"/>
      </xsl:when>
      <xsl:when test="@type='Date'">
         <INPUT type="text" name="1" size="2" maxlength="4"/> -
	 <INPUT type="text" name="1" size="2" maxlength="4"/> -
	 <INPUT type="text" name="1" size="4" maxlength="8"/>
      </xsl:when>
      <xsl:otherwise>
         <SELECT name="box" size="1">
            <xsl:for-each select="INPUTFIELD/OPTION">	<!-- THIS OPTION 
REFERS TO THE XML TAG -->
	       <OPTION>	<!-- OPENING HTML OPTION TAG	-->
	          <xsl:apply-templates />
	       </OPTION>	<!-- CLOSING HTML OPTION TAG	-->
	    </xsl:for-each>
         </SELECT>
      </xsl:otherwise>
   </xsl:choose>
</TD>

I hope some one can make sense of my thoughts. If anyone needs any more 
information, don't hesitate in contacting me.

I apprecriate any and all help.

Cheers,

Mike
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.