OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Input forms / XSL

[ Lists Home | Date Index | Thread Index ]
  • From: "Michael O' Dell" <maod@hotmail.com>
  • To: xml-dev@xml.org
  • Date: Wed, 31 May 2000 12:01:15 GMT

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@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS