Use XSLT to arrange a list of items in a table
I have a linear list of items which I wish to arrange in a table using XSLT. I wish to specify the number of columns as a parameter. For example, if I have a list of 12 items, I can select a 2x6, 3x4, 4x3 or 6x2 table. I cannot see a general way to do this.
I have seen this article: http://www.nedcomp.nl/support/origdocs/xml4/extracted/xpath_hdi_1_4llx.aspx
It tells you how to generate a table with a specific number of columns, but does not allow a general case. (Ideally there would b开发者_如何学编程e a loop for the xsl:value-of lines).
This is possible, in earlier answers of mine I show ways to do it.
- [XSLT]: Rendering a node sequence as M x N table
- How to CSS a two column list of items?
- xslt: How could I use xslt to create a table with multiple columns and rows?
To give an answer that fits your needs better, you'd have do show your XML.
精彩评论