[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: determine maximum columns in table

Subject: Re: determine maximum columns in table
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 07 Oct 2008 21:24:57 -0400
Re:  determine maximum columns in table
At 2008-10-08 13:20 +1300, Trevor Nicholls wrote:
 <!-- 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?

Just in the very way you said it:


count(td[not(@colspan)]) + sum(td/@colspan)

Consider the following:

  <td/>
  <td colspan="3"/>
  <td/>
  <td/>
  <td colspan="2"/>
  <td colspan="3"/>
  <td/>

This is 4 + ( 3 + 2 + 3 ) = 12

I hope this helps.

. . . . . . . . . . Ken

--
Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview:  http://www.youtube.com/watch?v=VTiodiij6gE
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.