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

RE: Newbie question: Incrementing the position in the

Subject: RE: Newbie question: Incrementing the position in the tree midstream
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Mon, 12 Apr 2004 22:36:32 +0200
xsl for each increment
> -----Original Message-----
> From: Durston, Andrew (AGRE)
>
<snip />
> test-plan/object/cell N
> test-plan/object/cell N+1
> test-plan/object/cell N+2
> test-plan/object/cell N+3
>
> I can search to find cell N. I'd like to be able to print cell N,
> cell N+1, cell N+2 ... all at once and then when XSL goes back
> to searching (via a For) through the tree, it skips N+1, N+2 etc.
> (basically does a table row and then skips to the beginning of
> the next row). Without entering another XML attribute into our DB
> to indicate beginning and end of rows... How do I increment
> the position, moving from object/cell N to object/cell N+1 midstream?
>

Hi,

Based on the above source tree, how are the rows in the result separated? By
being in different objects? Or does it depend solely on the index of the
cell (fixed number of cells in one row)?

(I think your problem is one of groupnng, so the obvious starting point
would be
http://www.jenitennison.com/xslt/grouping)

As an example, for positional grouping, 5 cells per row, you can do:

<table>
<xsl:for-each select="test-plan/object/cell[
               (position() mod 5)=1]">
  <tr>
  <xsl:for-each select=". | following-sibling::cell[
                  position() &lt;= 4]">
    <td><xsl:value-of select="." /></td>
  </xsl:for-each>
  </tr>
</xsl:for-each>
</table>


Hope this helps!

Cheers,

Andreas

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.