[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Newbie question: Incrementing the position in the
> -----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() <= 4]"> <td><xsl:value-of select="." /></td> </xsl:for-each> </tr> </xsl:for-each> </table> Hope this helps! Cheers, Andreas
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|