|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: table header respecting xml structure
Rui,
I had something siilar long ago. I can't find it right now, I 'll look in a while instead of re-writing it now. Some clarifications though will help: I guess you want to build an HTML table. So: something like: <table border="1" id="table1"> <tr> <td rowspan="3">Col 1</td> <td rowspan="3">Col2 </td> <td align="center" colspan="4">More cols</td> <td rowspan="3">Col 3</td> <td rowspan="3">Col 4</td> </tr> <tr> <td rowspan="2">Col 1</td> <td rowspan="2">Col2</td> <td align="center" colspan="2">depth cols</td> </tr> <tr> <td>Col1 </td> <td>Col 2</td> </tr> </table> right ? The other thing I don't get from this structure is are you going to have data in the columns ? Like <column desc="Col 2">Hello</column> ? Basically the idea is that when you find this root structure (btw is this the root of the document, or the root of this structure that represents tables?) you create the <table> html element and then you call a template with select="*" <xsl:choose>
<xsl:when test="name()='column'">
<td>
<xsl:attribute name="rowspan"><xsl:value-of select="count(group)+1"></xsl:attribute>
<xsl:value-of select="@desc"/>
</td>
</xsl:when><xsl:when test="name()='group'>
<td>
<xsl:attribute name="colspan"><xsl:value-of select="count(descendant::*)-1"></xsl:attribute>
<xsl:value-of select="@desc"/>
</td>
</xsl:when></xsl:choose>
</xsl:template>or something like that (that would basically count the elements inside the group and the descandant group(s) in order to know your colspan. Then ypu call another tempalte selecting all groups that would write you the TRs which would again call the previous tempalte fro columns. I am sorry I can't be more detailed or if this sounds confusing its out of my mind I haven't tried you. I 'll have a look if I find the stylesheet where I was doing something similar. Meanwhile if this turns out to be helpful please post saying you found it (it will save me time). Cheers, Manolis Rui Alberto L. Gonçalves wrote: Hi all, XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








