[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] determine maximum columns in table
I have input XML which includes tables of the following form: table - tt? - th? - tr* - td* - tb - tr* - td* - tf? - tr* - td* The requirement is to determine the maximum number of columns in the table. The number of columns spanned by a cell (td) element is provided in a colspan attribute, and if no colspan attribute exists the cell of course occupies one column. The following XSL template is defective inasmuch as it ignores colspan. The context node when this template is called is <table>. <!-- output maximum number of columns in any child row --> <xsl:template name="counttablecols"> <xsl:for-each select="*/tr"> <xsl:sort select="count(td)" order="descending" /> <xsl:if test="position() = 1"> <xsl:value-of select="count(td)" /> </xsl:if> </xsl:for-each> </xsl:template> I can't see how to modify the sort so that I count 1 for each non-colspanned td and the appropriate value for each td which does have a colspan attribute. Is it possible? An XSL 1.0 solution is preferred. Cheers Trevor
|
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
|