Jump to content

halfhand

Members
  • Posts

    3
  • Joined

  • Last visited

halfhand's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. 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.
  2. I did see that, but I had tried something similar to one of the posted solutions that didn't work. I have since delved deeper into a different linked solution and I think it will work out. Thanks for the reply and sorry for the superfluous post.
  3. I have a problem here that is beyond the scope of my limited XSL knowledge. I have a bit of xml that is coming from a third party that I need to format into an xml table. The xml I am getting looks like this: <cells> <cell row="0" column="0"> <data>1</data> </cell> <cell row="0" column="1"> <data>2</data> </cell> <cell row="0" column="2"> <data>3</data> </cell> <cell row="1" column="0"> <data>Insert a hickey doo</data> </cell> <cell row="1" column="1"> <data>Test</data> </cell> <cell row="1" column="2"> <data>Text</data> </cell> </cells>I'm completely stumped as to how to do this. How can I take this list and break it into rows? Is there some way to layout a nested for-each to manage this? I appreciate any help of thoughts anyone has.
×
×
  • Create New...