I am working with table entry elements and want to get all preceding entry elements in the same table that pass the following test:
parent::row/preceding-sib
If your processor can do the exslt:node-set function or an equivalent such as that provided by msxml then you could attack this procedurally, using a tail-recursive template. Ugly, I know, and completely against what we usually recommend for XSLT, but in this case I think the only way to do this efficiently is to pass information from one row to the next. Assuming that the first row of the table will always have an entry
for every column, then how about something like this:
(Wow, that ended up much more complex than I expected when I started it, but I've tested it out and it seems to work correctly). The idea here is that we build a structure that encodes the number of rows that each column still needs to span over at the point where that row is processed. So for the first row we'll have
then for the second it'll be
the third
etc. For each row we then iterate over this structure rather than over the entry
elements themselves.
Edit: now you've changed the question so you need to account for the possibility of column spans as well as row spans it gets much much messier. Since we're committed to using a node-set function, I would think about a two-step approach as hinted at by LarsH, where you first expand out the column spanning entries into real entry
elements (with some attribute to identify them as such) and then process the expanded version of the XML in place of the original.