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

if-questioning between two nodes inside an for-each-loop

Subject: if-questioning between two nodes inside an for-each-loop
From: "Matthiessen, Armin" <Armin.Matthiessen@xxxxxxxxxxxxxx>
Date: Fri, 15 Sep 2000 13:58:40 +0200
xsl variable name choose
Hi all,

i have the following problem:

inside from a HTML-side i want show a select box with content from the tags
"single". 
This box should be a pre-selection to the content of the tag "choose". To
find out, which
tag is pre-selected i try it with a if-question between the node in den
variable-definition
an the node inside the "for-each"-loop. But i don't get a result from the
if-clause.

Why?
How can i get a solution?



xml-part:

<cars>
<single>BMW</single>
<single>VW</single>
<single>MERCEDES</single>
<single>AUDI</single>


<choose>VW</choose>
</cars>

xsl-part:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:param name="lang" select="en"/>
  <xsl:template match="/">

    <html>
      <head>
      </head>
      <body>
	<h1>The choosed car is:</h1>
	<select name="CARS">

            <xsl:variable name="CHOOSE">
		<xsl:value-of select="cars/choose"/>
	</xsl:variable>

	  <xsl:for-each select="cars/single">
	  	<option>
	    	<xsl:attribute name="value">
	     	 <xsl:value-of select="."/>
	   	 </xsl:attribute>
	   	 <xsl:value-of select="."/>
		  
		  <xsl:if test=". = CHOOSE">
			<xsl:attribute name="selected">
			</xsl:attribute>
		  </xsl:if>
	 	 </option>

	</xsl:for-each>
          </select>
       </body>
     </html>
  </xsl:template>
</xsl:transform>


Armin


      


 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.