<p>I'm trying to produce sheets of photographs with captions arranged in a grid using XSLT and XSL-FO. The photo URLs and captions are produced using a FOR XML query against an SQL Server database, and the number of photos returned varies from sheet to sheet. I want to lay the photos out in four columns, filling the grid from left to right and from top to bottom. In HTML I'd do this by putting each photo and caption into a div and using "float: left" to make them flow into the grid. Is there a similarly elegant method using XSL-FO?</p>

[{'answer_id': 54031, 'author': 'Matt Large', 'author_id': 2978, 'author_profile': 'https://Stackoverflow.com/users/2978', 'pm_score': 3, 'selected': True, 'text': '<p>To keep life simple I would normally setup a table for this, it\'s quite simple and will ensure that things get laid out right. If you wanted to do it similarly to how you would do it in HTML then you should layout block-container elements.</p>\n\n<p>However you decide to do it I would always recommend using the <a href="http://www.zvon.org/xxl/xslfoReference/Output/index.html" rel="nofollow noreferrer">ZVON Reference</a> site. Nice lookup of elements and available attributes, and while their XSL-FO doesn\'t include much in the way of explanation every page deep links to the standards document.</p>\n'}, {'answer_id': 54053, 'author': 'Rich', 'author_id': 5465, 'author_profile': 'https://Stackoverflow.com/users/5465', 'pm_score': 0, 'selected': False, 'text': '<p>In the end I used a table with one row and four cells for this. In each one I selected the source elements with position() mod 4 equal to 0, 1, 2 or 3 as appropriate, and then made sure that the photo and caption was always the same height so the rows lined up correctly.</p>\n'}]
['https://Stackoverflow.com/questions/53913', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5465/']