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

RE: For-each iteration problem

Subject: RE: For-each iteration problem
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Thu, 18 Mar 2004 16:49:38 -0600
checkbox iteration
Hi Kaerstin,

>I have a piece of xml that will be printed out as html checkboxes or radio
boxes depending on the value of the multiple 
>variable (which will be radio or checkbox)... I was unable to get this to
work easily, and the code I am using now seems 
>to put an extra/blank input box before each value...

You need to assign the 'multiple' and 'label' parameters. In your case it
would be adding some expression to the select attribute of the <xsl:param>.
I aslo took the liberty to change the value you are adding to the input

With your XML, the following XSL

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
<xsl:output method="html" indent="yes"/>

<xsl:template match="/">
	<xsl:apply-templates select="dataElement/possibleValues" />

<xsl:template match="possibleValues" >
   <xsl:param name="multiple">Checkbox</xsl:param>
   <xsl:param name="label">rb</xsl:param>
   <xsl:for-each select="node()" >
       <input type="{$multiple}" name="{$label}" value="{.}">
         <xsl:value-of select="node()" />    
       <xsl:if test="position() mod 4 = 0">
         <br />


Produces the output using Radio (the checkboxes can be achieved by replacing
'Radio' with 'Checkbox'):

<input type="Checkbox" name="rb" value="image">image??
<input type="Checkbox" name="rb" value="webpage">webpage??
<input type="Checkbox" name="rb" value="text">text??
<input type="Checkbox" name="rb" value="number">number??
<input type="Checkbox" name="rb" value="money">money??
<input type="Checkbox" name="rb" value="animal">animal??
<input type="Checkbox" name="rb" value="mojo">mojo??


Cheers, Pieter

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

Current Thread


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.
First Name
Last Name
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.