Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2012, 06:54 AM
Registered User
 
Join Date: Jan 2012
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default How generate dropdownbox

Hi everybody,

I have this:
XML
Code:
<?xml version="1.0" encoding="utf-8" ?>
<FORM ID="1" Formtitle="Form Builder">
  <FIELDS>
    <!--Label Form-->
    <FIELDSET Legend ="Form for newsletter" >
      <!--end label-->
      <FIELD fieldName ="formTitle1 " label =" Title"/>
      <FIELD fieldName ="Field0"      label ="Achternaam: " type="Text" Required="1" />
      <FIELD fieldName ="Field1"      label1 ="Voornaam: " type ="Text" Required ="1"/>
      <FIELD fieldName ="Field2"      label2 ="Email" type ="Text " Required ="1"/>
      <FIELD fieldName ="Field3"      label ="Email" type="Text" Required ="0"/>
      <BUTTON fieldName ="Button1 "   type ="Button" label ="btnSave" Text="Save" Required ="0"/>

      <!--RadioButtons-->
      <FIELD FieldName ="Field4" Label ="Geslacht: " Type="Radio" Required="0">
        <OPTION value ="1" Text ="Man"/>
        <OPTION value ="2" Text ="Female"/>
      </FIELD>
      <!--DropDownBox1-->
      <SELECT name="DropDownList1" id="DropDownList1" Type="DropDownList" Required="0">
        <OPTION value="1">Niels, Engelen</OPTION>
        <OPTION value="2">Marilyn, VosSavant</OPTION>
      </SELECT>

      <!-- creating select box Test -->
      <FIELD type="DropDownList" label="Title:">
        <PROPERTIES>
          <SELECT name="ID">TITLE</SELECT>
        </PROPERTIES>
        <OPTIONS>
          <OPTION value="0">Hallo</OPTION>
          <OPTION value="1">Hallo2</OPTION>
          <OPTION value="2">Hallo3</OPTION>
          <OPTION value="3">Hallo4</OPTION>
          <OPTION value="4">Hallo5</OPTION>
        </OPTIONS>
      </FIELD>
      
      <DROPDOWNCONTROL id="dd1" name="ShowValues" choices="choice1,choice2,choice3,choice4">
      </DROPDOWNCONTROL >

    </FIELDSET>
  </FIELDS>
</FORM>
and for xslt:
Code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" encoding="utf-8"/>
  <xsl:decimal-format name="euro" decimal-separator="," grouping-separator="." />
  <xsl:output method="html"/>
  <xsl:template match="/FORM">
    <html>
      <body>
        <h1>
          <xsl:value-of select="@Formtitle"/>
        </h1>
        <FORM id="1" action="myurl.com">
          <FIELDSET>
            <legend>
              <xsl:value-of select="FIELD/FIELDSET/@Legend"/>
            </legend>

            <!--TextFieldAchternaam-->
            <xsl:for-each select="FIELDS/FIELDSET/FIELD">
              <xsl:if test="@Type = 'Text'">
                <xsl:if test="@Required='1'">
                  <!--Achternaam-->
                  <label>
                    <xsl:value-of select="@Label"/>
                  </label>
                  <br/>
                  <!--Label Vorrnaam-->
                  <label>
                    <xsl:value-of select="@Label1"/>
                  </label>
                  <!---->
                  <br/>
                  <!--Voornaam-->
                  <input type="text" name="{@FIELDNAME}" class="jqueryValidate"/>
                </xsl:if>
                <xsl:if test="@Required='0'">
                  <br/>
                  
                  <!--TextFieldVoornaam-->
                  <label>
                    <xsl:value-of select="@Label1"/>
                  </label>
                  <br/>
                  <input type="text" name="{@FIELDSET}" class ="jqueryValidate"/>
                  <br/>
                  <label>
                    <xsl:value-of select="@label2"/>
                  </label>
                 
                  
                </xsl:if>
              </xsl:if>

              <xsl:if test="@Required='0'">
                <xsl:for-each select="Option">
                  <label>
                    <xsl:value-of select="Label"/>

                  </label>
                  <input type="text" name="Field2"/>
                </xsl:for-each>
              </xsl:if>
              <br/>

              <xsl:if test="@Type = 'Radio'">
                <xsl:if test="@Required='1'">
                  <label>
                    <xsl:value-of select="@Label"/>
                  </label>
                  <input type="radio" name="{@FieldName}" class="jqueryValidate"/>
                  <br/>
                </xsl:if>
                <br/>

                <!--RadioButtonGeslacht-->
                <xsl:if test="@Required='0'">
                  <label>
                    <xsl:value-of select="@Label"/>
                  </label>
                  <xsl:for-each select="OPTION">
                    <label>
                      <xsl:value-of select="@Text"/>
                    </label>
                    <input type="radio" name="Field4" Value="1"/>
                  </xsl:for-each>
                </xsl:if>
                <br/>

                <!--DropDownList1-->
                <xsl:if test="@Required='0'">
                  <label>
                    <xsl:value-of select="@DropDownList1"/>
                  </label>
                  <xsl:for-each select="OPTION">
                    <input type="DropDownList" name="DropDownList1"/>
                  </xsl:for-each>
                </xsl:if>
                <br/>

               
                <!--DropdownBox voor hallo-->
                
                <label>
                  <xsl:value-of select="@label"/>                  
                </label>
                <SELECT ID ="TITLE">                  
                  <!--<xsl:for-each select="OPTIONS/OPTION">-->
                  <xsl:for-each select="values/OPTIONS/OPTION['@selected=2']">
                    <OPTION>
                      <xsl:attribute name="value">
                        <xsl:value-of  select="@value"/>
                        <xsl:text>oke:</xsl:text>
                      </xsl:attribute>
                      <xsl:value-of select="@name"/>
                    </OPTION>
                                     </xsl:for-each>
                </SELECT>

                <!--End dropDownBox-->


                <!--Button Send-->
                <xsl:if test="@Required='0'">
                  <label>
                    <xsl:value-of select="@Text"/>
                  </label>
                  <xsl:for-each select="@PROPERTIES/PROPERTY">

                    <input type="BUTTON" name="Button1"  Select="@Label"/>
                  </xsl:for-each>
                </xsl:if>
                <br/>


                <!--Validation Form-->
              </xsl:if>
            </xsl:for-each>
          </FIELDSET>
        </FORM>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>
But how to get the values of the drop down box?

THX everybody for help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Iterating through DropDownBox rsearing ASP.NET 2.0 Basics 8 January 3rd, 2007 04:35 PM
Problem with dropdownbox angshujit ASP.NET 1.0 and 1.1 Basics 7 December 28th, 2006 09:39 AM
DropDownBox inside FormsView - Urgent shaly ASP.NET 2.0 Basics 1 December 6th, 2006 05:52 PM
Combining Two DataTextField's for a DropDownBox testsubject ADO.NET 1 January 3rd, 2006 12:34 PM
Combining Two DataTextField's for a DropDownBox testsubject VB.NET 1 January 3rd, 2006 12:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.