I misspoke in my initial post. What I was trying to transform the xml structure to was not just an XML table but an XSL <fo:table>. Since nothing I was able to find here on the forums led me in the right direction, I thought I would post the solution for anyone else who might also be looking for an answer to this problem.<xsl:template match="spreadsheet"> <fo:table> <fo:table-body> <xsl:apply-templates select="cells/cell"> <xsl:sort select="@row"/> <xsl:sort select="@column"/> </xsl:apply-templates> </fo:table-body> </fo:table> </xsl:template> <xsl:template match="cell"> <fo:table-cell xsl:use-attribute-sets="tablecells"> <xsl:if test="@row != preceding-sibling::*[1]/@row"> <xsl:attribute name="starts-row">true</xsl:attribute> </xsl:if> <fo:block><xsl:value-of select="data" /></fo:block> </fo:table-cell> </xsl:template>
Although I haven't tried it I think it might also provide a more elegant solution to some of the "Building a dynamic HTML table" problems I've seen.It took me a lot of time to get here and I hope this saves some other newbie a headache or is at least useful to someone.