Hi !
Instead of <input type="{$multiple}" name="{$label}" value="node()"> write :
<input type="{$multiple}" name="{$label}" value="{node()}"> or even shorter
:
<input type="{$multiple}" name="{$label}" value="{.}">
(everywhere node() can be replace by ".")
But I don't really see what you feel like to do... What are the parameters
multiple, label, do you give them a value anywhere ? What is the meaning of
the test to had a <br/> ? How do you match the other xml elements ?
Cheers,
Matthieu.
-----Message d'origine-----
De : owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]De la part de
Johnson,
Kaerstin
Envoyé : jeudi 18 mars 2004 22:12
À : xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Objet : [xsl] For-each iteration problem
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()" />    
</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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list