[Home] [By Thread] [By Date] [Recent Entries]
Hi,
I'm a relative newbie with XSLT but have got about 90% of a conversion task taking XHTML describing table information to relational XML ready for a database. My problem is this, each row of the HTML table has varying number of columns, and I want to wrap certain rows of data in a new output element. Basically I'd like to cycle through table <tr> tags, check if the first child <td> tag of each row has a rowspan value of 2 or 5, and if so wrap the translated output from that row, and every row following it, with my new tags *until* I encounter a row with that row-span value again. I've tried something like this (which XSLT doesn't seem to like): <xsl:template match="table">
<xsl:for-each-group select="tr"
group-starting-with="td/@colspan=5">
<xsl:value-of select="current-group()" />
</xsl:for-each-group>
</xsl:template>Is it possible to create groups using a path to a nested node and an explicit evaluation? Also once I have these groups, what basic structure should I use to parse the contents of each group. I've already written code which successfully translates the values of <td> tags in the <table> but to date I haven't need to use grouping. Any help greatly appreciated. I'm using XSLT 2.0 with the Saxon 8.1B processor. Cheers, Matt ------------------------------------------------------------------- Matt Poff - Director HEADFIRST LTD Web Developers Engaging | Useful | Works Email: matt.poff@xxxxxxxxxxxxxxx Ph: 64 4 477 6075 Mob: 027 229 9584 http://www.headfirst.co.nz
|

Cart



