[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: rookie questions - Try 2

Subject: RE: rookie questions - Try 2
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 18 Apr 2000 09:43:56 +0100
RE: rookie questions - Try 2
> Currently each time it loops through the results a </TR> is 
> inserted to end the row in a html table.  How would I modify the style
sheet 
> to insert that tag every other time it loops through?

First you need to understand that stylesheets don't write tags, they write
nodes to a tree. Creating a TR element node is one operation, you can't
split it into writing a start tag and an end tag.

You want to create a TR element node for every 2 items in the input, so the
simplest way to do it is along the lines:

<xsl:template match="item[position() mod 2 = 0]">
   <tr>
   <td><xsl:value-of select="."/></td>
   <td><xsl:value-of select="following-sibling::item"/></td>
   </tr>
</xsl:template>

<xsl:template match="item[position() mod 2 != 0]"/>

Mike Kay


 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.