Subject: Re: For-each iteration problem
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 18 Mar 2004 17:33:54 -0500
|
Kaerstin,
<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>
Your problem is almost undoubtedly here:
<xsl:for-each select="node()"> ... </xsl:for-each>
This says to select all child nodes for processing. Your source data
snippet suggests that you have text nodes mixed in with the <values>
elements you want:
<possibleValues>
<values>image</values>
<values>webpage</values>
<values>text</values>
<values>number</values>
<values>money</values>
<values>animal</values>
<values>mojo</values>
</possibleValues>
Notice each <values> element is preceded by a line feed plus some leading
whitespace. These text nodes (which contain nothing but white space) are
getting selected, and input boxes created for them.
Either use xsl:strip-space to remove these text nodes from your input tree,
or write for-each select="values", and the problem should clear up.
I hope that helps,
Wendell
======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|