[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] For-each iteration problem
Subject: RE: [xsl] For-each iteration problem From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx> Date: Thu, 18 Mar 2004 16:49:38 -0600 |
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 controls. With your XML, the following XSL <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates select="dataElement/possibleValues" /> </xsl:template> <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()" /> </input>   <xsl:if test="position() mod 4 = 0"> <br /> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> 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 <br> <input type="Checkbox" name="rb" value="money">money <input type="Checkbox" name="rb" value="animal">animal <input type="Checkbox" name="rb" value="mojo">mojo HTH Cheers, Pieter XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] For-each iteration proble, Ricaud Matthieu | Thread | [xsl] Cannot get numeric value - wh, Kyle Partridge |
Re: [xsl] Cannot get numeric value , Wendell Piez | Date | RE: [xsl] Efficient recursive group, Michael Kay |
Month |