[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: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 18 Mar 2004 17:33:54 -0500
xsl for each iteration
Kaerstin,

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

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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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