Subject: Re: [xsl] Aligning Parallel Columns From: Jeroen Hellingman <jeroen@xxxxxxxx> Date: Sat, 15 Jan 2011 16:32:05 +0100 |
On 2011-01-15 13:38, G. Ken Holman wrote: > At 2011-01-15 07:22 -0500, I wrote: >> Use for-each-group on the name attributes. You will end up with five >> groups. As you walk through each of the five groups, looking at each >> element's parent will tell you which side of the table the item >> belongs in. > > More precisely, as you walk through each of the five groups of > attributes, walk through the parent elements in table column order to > select that member of the group that is a descendant of the parent. > That way you'll walk through the group in the correct order to generate > table cells and know if the item is absent from the parent to know to > put in an empty cell. > > I hope this helps. > > . . . . . . . . Ken Thanks for the hint. My current solution depends on being able to sort the names, which isn't entirely satisfying ($a and $b contain the two divs to be aligned): <table> <xsl:for-each-group group-by="@name" select="$a/p, $b/p"> <xsl:sort select="@name"/> <xsl:variable name="name" select="@name"/> <tr> <td> <xsl:value-of select="$name"/> </td> <td> <xsl:if test="$a/p[@name = $name]"> <xsl:apply-templates select="$a/p[@name = $name]"/> </xsl:if> </td> <td> <xsl:if test="$b/p[@name = $name]"> <xsl:apply-templates select="$b/p[@name = $name]"/> </xsl:if> </td> </tr> </xsl:for-each-group> </table> Jeroen.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Aligning Parallel Columns, G. Ken Holman | Thread | Re: [xsl] Aligning Parallel Columns, G. Ken Holman |
Re: [xsl] Aligning Parallel Columns, G. Ken Holman | Date | Re: [xsl] Aligning Parallel Columns, G. Ken Holman |
Month |