[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Diff table for spotted nodes
Hi Yan, I assume that you want to create a new table for each test-row without another elements between them. So you must select all test-elements, where the precedessor is not test. <xsl:template match="doc_root"> <xsl:apply-templates select="test[name(preceding-sibling::*[1])!= 'test']" mode="table"/> </xsl:template> Now you create the table and apply the same test-element again for creating the first tablerow. <xsl:template match="test" mode="table"> <table> <xsl:apply-templates select="." mode="tablerow"/> </table> </xsl:template> The last template creates for the first and all directly following test-elements a tablerow. <xsl:template match="test" mode="tablerow"> <tr> <td><xsl:value-of select="text()"/></td> </tr> <xsl:apply-templates select="following-sibling::*[1][name()='test']" mode="tablerow"/> </xsl:template> Hope this helps, Joerg ----- Original Message ----- From: "yan bai" <bytj@xxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Monday, November 26, 2001 4:12 PM Subject: Diff table for spotted nodes > Gurus, > I've tries this many times, but with no result. > I have an .xml file which contains the following > element. > > <doc_root> > ... > <test>Value 1</test> > <test>Value 2</test> > <test>Value 3</test> > <test>Value 4</test> > <other>Other value</other> > <another>another value</another> > <test>Value 5</test> > <test>Value 6</test> > .... > </doc_root> > > I need to transform them into a html page. Here, > all adjacent <test> nodes should be put into one > table. > Thus, in this case, Value 1, Value 2, Value 3, Value 4 > have to be in one table. Value 5 and Value 6 should > be in another table. > > Any one can help? > > Yan > > > __________________________________________________ > Do You Yahoo!? > Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. > http://geocities.yahoo.com/ps/info1 > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > 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
|