Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 2nd, 2005, 10:35 PM
Registered User
 
Join Date: Mar 2005
Location: Chennai, Tamil Nadu, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ujayaraman
Default XSLT Looping Logic - Very Urgent

I'm getting all the collection items in the page by looping, but as we have the line in the XSLT “<![CDATA[</td></tr><tr><td width="200">]]>”, "</TD><td width=”200”>" is displaying in the page, instead of being rendered in HTML as per our desire.

Please provide us the solution. Thanks a lot for your help.

XSLT:
<tr>
      <td width="200">
            <xsl:for-each select="EDMS/SendALink/IOProduct/Counter">

                <xsl:variable name="count"><xsl:value-of select="Counter"/></xsl:variable>

                  <xsl:choose>

                        <xsl:when test="$count mod 3=0">

                               <![CDATA[</td></tr><tr><td width="200">]]>

                       </xsl:when>



                        <xsl:otherwise>

                              <![CDATA[</td><td width="200">]]>

                         </xsl:otherwise>



                  </xsl:choose>

             </xsl:for-each>

      </td>

</tr>



Thanks and Best Regards,
U Jayaraman,
Wipro Technologies,
My Web Site : http://ujayaraman.faithweb.com
Mobile : +919884112047
__________________
Thanks and Best Regards,
U Jayaraman,
Wipro Technologies,
My Web Site : http://ujayaraman.faithweb.com
Mobile : +919884112047
Reply With Quote
  #2 (permalink)  
Old March 3rd, 2005, 04:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

If you want to create a new row every 3 items then you need to apply a grouping technique, maybe like this:
http://www.biglist.com/lists/xsl-lis.../msg00202.html
Reply With Quote
  #3 (permalink)  
Old March 3rd, 2005, 09:42 AM
mhkay's Avatar
Wrox Author
Points: 17,682, Level: 57
Points: 17,682, Level: 57 Points: 17,682, Level: 57 Points: 17,682, Level: 57
Activity: 22%
Activity: 22% Activity: 22% Activity: 22%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,825
Thanks: 0
Thanked 263 Times in 258 Posts
Default

XSLT writes trees, not tags. You can't write a start tag in one operation and an end tag in another operation, because nodes on a tree are indivisible objects.

You're trying to do a grouping operation: the correct way of doing this is described at http://www.jenitennison.com/xslt/grouping



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping through a list using logic tags problem aadz5 Struts 3 September 23rd, 2011 03:18 AM
XSLT 1.0: Looping through nodes kwilliams XSLT 4 December 1st, 2008 05:21 PM
Not able to implement the given logic in my XSLT ashyabhi_hp XSLT 2 January 27th, 2006 06:24 AM
xslt looping richjo100 XSLT 6 September 23rd, 2004 11:20 AM
Looping. Please help....Urgent junemo PHP How-To 0 July 20th, 2004 10:13 PM



All times are GMT -4. The time now is 04:24 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.