Search
Web Braintrove
Site Navigation
Home
Products
Tags
Levels
Dates
Authors
5 MOST RECENT
Locate the Design Checker Task Pane in InfoPath 2010
Locate Conditional Formatting and Custom Validation in InfoPath 2010
Conditionally Display Different Values In a Single Expression Box
Create a Button With a Blank Label
Create Shared Rules
5 MOST POPULAR
Access a Method in a Master Page with Code-Behind
Pass Query String Parameters to an ASP.NET Xml Control
Prevent Namespace Prefixes from Being Copied to the Output
Create Groups in a Drop-Down List Box
Configure IIS 7 for Custom Error Pages
5 MOST FORGOTTEN
Install Windows 7 Beta onto a Virtual Machine
Group Dates by Year, Month and Day
Configure Lab Color Mode Defaults for Braintrove Articles
Create a Monochromatic Dream Text Effect Using Styles
Combine Multiple Sums Into a Single Function
Books
XSLT
XSLT Developer's Guide
Dynamic HTML: The Definitive Reference
XSLT 2.0 Web Development
Learn HTML 4 In a Weekend
Magazines
Inside Visual Basic
Web Site Management And Internet Advertising Trends
Inside Web Design
MSDN Magazine
Practical Web Design
Microsoft MVP
Popular
This article has been viewed 1555 times.

Display Lists in Columns Horizontally Using One Cell per Column

Page 1 of 2
Written by Gregory Scot Collins
Tuesday, 19 September 2006, 7:25 AM
This article has been tested to work with the following products and versions. No guarantee of compatibility, with or without modification, is offered for products or versions other than those listed.
When outputting lists it is often helpful to display the list items in multiple columns. This allows more items to fit on a single row, thus taking fewer rows to display the list. The example code in this article allows for an arbitrary number of columns to be rendered for a given list. The number of columns can either be hard-coded or passed in to the transform as a parameter. For this example we will hard-code the number into a variable.
There are a minimum of four techniques you can use to render your list items in multiple columns. This article covers displaying items left-to-right top-down with items combined in a single table cell per column. Links to three other articles, demonstrating different techniques, can be found in the See Also box.

Create the Items.xml file

We need a simple XML file to transform that contains our list of items that we can output in multiple columns. Copy the contents of Listing 1 into a text editor, and then save the file as Items.xml.

Create the Columns-Horizontal-Combined.xsl file

Now we need a transform to output our list items in an arbitrary number of columns. You will find the number of columns hard-coded to seven in the COLS variable. Feel free to adjust this number to whatever you choose; or, if you prefer, you can change it into a parameter, and then pass in the value when applying the transform.
Copy the contents of Listing 2 into a text editor, and then save the file as Columns-Horizontal-Combined.xsl. Be sure to save it in the same folder as the Items.xml file.
Bookmark this Article
StumbleUpon  Stumble It!
Digg  Digg It!
del.icio.us  del.icio.us
List of Figures
Listing 1 - The Items.xml file.
Listing 2 - The Columns-Horizontal-Combined.xsl file.
Screenshot 1 - The list of items rendered in seven columns.
See Also
Display Lists in Columns Horizontally Using Individual Cells
Display Lists in Columns Vertically Using One Cell per Column
Display Lists in Columns Vertically Using Individual Cells
Article Tags
Great Deals
TigerDirect Exclusive Deals, Limited Time Offers, Act Now And Save!
Find all current special offers on Adobe products.
Try SugarSync Free!
Join WebHost4Life.com
TigerDirect
Computers4SURE (4SURE.com - An Office Depot Co.)
Copyright © 2006-2010 Braintrove. All rights reserved. Braintrove, braintrove.com, and the Braintrove logo are trademarks of Gregory Scot Collins in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Any rights not expressly granted herein are reserved.