|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to calculate rowspan?
Hi Anton,
<xsl:choose>
<xsl:when test="@Type='Dimesion'">
<xsl:variable name="pos" select="position()"/>
<xsl:variable name="val" select="."/>
<xsl:if test="not(../preceding-sibling::*[1]/*[$pos and .=$val])">
<xsl:variable name="rowspan" select="count(../following-sibling::*/*[$pos and .=$val])+1"/>
<td rowspan="{$rowspan}">
<xsl:value-of select="."/>
</td>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:value-of select="."/>
</td>
</xsl:otherwise>
</xsl:choose>
This will give you the output you want, for your sample input
but... it only works if your "Dimesion" values are unique.
Consider your first column (the "COL0" elements): A-A-A-B-B-C
This is OK. But if you would replace the last 'C' with an 'A'
(A-A-A-B-B-A) it doesn't work anymore because you would get
a rowspan="4" instead of 3.
I hope this solution is sufficient for you, because if you really
need to calculate only consecutive equal values, I'm stuck...
Best regards
Anton Triest
|
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








