How to account for optional elements in a table in XSL?
I’m parsing an XML file which has optional elements. I want to produce a table from the rows but need to check for the presence of the optional elements and put appropriate empty cells where needed. The way I found to keep the columns in order is with multiple rules with importance attributes and select in actions. It’s a bit busy and I’m wondering, since this is a problem that often comes up, if it’s the best way to handle this. Here’s the simplified XSL rules, for a table with 5 columns, elements 3 4 optional: