Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2005, 11:35 PM
Registered User
 
Join Date: Mar 2005
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
 
Old March 3rd, 2005, 05:55 AM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old March 3rd, 2005, 10:42 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 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





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 06:21 PM
Not able to implement the given logic in my XSLT ashyabhi_hp XSLT 2 January 27th, 2006 07: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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.