[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Turning off 'well-formedness'
> I am trying to create the following marked-up tags using > MSXML3 on an IE5.x > browser: > > <td> > data1 <br /> > data2 <br /> > data3 <br /> > </td> > <td> > data4 <br /> > data5 <br /> > data6 <br /> > </td> > ---------------------------------------------------------- > my source file looks like: > > <Data> > <Record>data</Record> > <Record>data</Record> > <Record>data</Record> > <Record>data</Record> > <Record>data</Record> > <Record>data</Record> > </Data> > ---------------------------------------------------------- This is a common requirement and the usual XSLT 1.0 solution is: <xsl:template match="Record[position() mod 3 = 1]"> <td> <xsl:for-each select=".|following-sibling::Record[position() < 3]"> <xsl:value-of select="."/><br/> </xsl:for-each> </td> </xsl:template> <xsl:template match="Record"/> In XSLT 2.0 you can do <xsl:template match="Data"> <xsl:for-each-group group-starting-at="Record[position() mod 3 = 1]"> <td> <xsl:for-each select="current-group()"> <xsl:value-of select="."/><br/> </ </ </ </ Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|