xsl-list
[Top] [All Lists]

For-each iteration problem

2004-03-18 14:12:02

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

Below is the code Im using starting from match possibleValues and the xml
snippet it 'should' translate...

<xsl:template match="possibleValues" >
     <xsl:param name="multiple"/>
     <xsl:param name="label"/>

                      <xsl:for-each select="node()" >
                <input type="{$multiple}" name="{$label}" value="node()">
                <xsl:value-of select="node()" />    &#160; &#160;
                </input>
                <xsl:if test="position() mod 4 = 0"> <br /> </xsl:if>

               </xsl:for-each>



</xsl:template>

sample xml:
<dataElement>
                <name>Field Name</name>
                <description>Field Description</description>
                <visible>visible</visible>
                <display>choicebox</display>
                <optional>optional</optional>
                <multipleAllowed>true</multipleAllowed>
                <possibleValues>
                        <values>image</values>
                        <values>webpage</values>
                        <values>text</values>
                        <values>number</values>
                        <values>money</values>
                        <values>animal</values>
                        <values>mojo</values>
</possibleValues>
        </dataElement>

Any help is greatly appreciated...



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



<Prev in Thread] Current Thread [Next in Thread>