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

default value in combobox

Subject: default value in combobox
From: "Weber, Hans-Jürgen" <H-J.Weber@xxxxxx>
Date: Wed, 20 Aug 2003 11:00:49 +0200
combobox default value
Hello,

I want to show a default value for a combobox and an input field
(see test.xsl and test.xml below).
There are two loops in the xsl file:
One for the rows to be displayed and one for the combobox.

The output should be:

Test
row 1: Combobox1: Type 1  Field 1: Description 1
row 2: Combobox2: Type 2  Field 2: Description 1

but it is:

Test
row 1: Combobox1: Type 2  Field 1: Description 1
row 2: Combobox2: Type 2  Field 2: Description 1

What can I do?
Thanx.

test.xsl:

<?xml version="1.0" encoding="iso-8859-1"?>  
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  
<xsl:template match="root">
<html>  
<head>  
   <title>Test</title>
</head>  
<body>
<h1>Test</h1>
<form name="form">
   <xsl:for-each select="/root/data/main/Agreement/Pgas/Pga">
   <p>
	<select name="pgatypeid{PgaTypeid}" size="1">	
	   <xsl:for-each select="/root/data/main/pgatypes/Pgatype">
         <option value="{PgatypeId}">
         <xsl:if
test="PgatypeId=/root/data/main/Agreement/Pgas/Pga/PgaTypeid">
            <xsl:attribute name="selected">selected</xsl:attribute>
         </xsl:if>             
          <xsl:value-of select="PgatypeName"/></option>                  
      </xsl:for-each> 
   </select>    
   <input name="pgacomment{PgaTypeid}" maxlength="40" value="{PgaComment}"/>
   </p>
   </xsl:for-each>
</form>
</body>  
</html>      
</xsl:template>
</xsl:stylesheet>

test.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="test.xsl" type="text/xsl"?>
<root>
   <!--********** XML DATA **********-->
   <data>
      <main>
         <pgatypes>               <!-- rows to be displayed -->
            <Pgatype>
               <PgatypeId>1</PgatypeId>
               <PgatypeName>Type 1</PgatypeName>
            </Pgatype>
            <Pgatype>
               <PgatypeId>2</PgatypeId>
               <PgatypeName>Type 2</PgatypeName>
            </Pgatype>
       </pgatypes>
       
       <Agreement>                <!-- default values to be displayed -->

            <Pgas>
               <Pga>
                  <PgaTypeid>1</PgaTypeid>
                  <PgaComment>Description 1</PgaComment>
               </Pga>
               <Pga>
                  <PgaTypeid>2</PgaTypeid>
                  <PgaComment>Description 2</PgaComment>
               </Pga>
            </Pgas>
         </Agreement>
      </main>
   </data>
</root>   

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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
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.