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

Re: Maximum number of cells

Subject: Re: Maximum number of cells
From: Miloslav Nic <nicmila@xxxxxxxxx>
Date: Wed, 20 Dec 2000 23:39:05 +0100
xsl limit number of elements
XML:

<table>
<tr><td/><td/><td/></tr>
<tr><td/><td/><td/><td/><td/><td/><td/></tr>
<tr><td/><td/><td/><td/></tr>
<tr><td/><td/></tr>
<tr><td/></tr>
<tr><td/><td/><td/></tr>
</table>


XSLT:

<xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


  <xsl:template match="tr">
    <xsl:value-of select="count(td)"/>
    <xsl:text>~</xsl:text>
  </xsl:template>

  <xsl:template match="table">
    <xsl:variable name="xxx">
      <xsl:apply-templates select="tr">
	<xsl:sort data-type="number" order="descending" select="count(td)" />
      </xsl:apply-templates>
    </xsl:variable>

    <xsl:value-of select="substring-before($xxx,'~')"/>
  </xsl:template>

</xsl:stylesheet>

"Dudley, Mark" wrote:
> 
> Hello,
> 
> Given the following XML:
> 
> <table>
>   <row>
>    <cell>...</cell>
>   </row>
>   <row>
>    <cell>...</cell>
>    <cell>...</cell>
>    <cell>...</cell>
>   </row>
>   <row>
>    <cell>...</cell>
>    <cell>...</cell>
>   </row>
> </table>
> 
> I need to compare the number of cells in each row element and get the count
> of cell elements in the row that has the most (3 in this case).  Does anyone
> have any ideas? Any help would be greatly appreciated.
> 
> Mark Dudley
> Xerox Corp.
> mark.dudley@xxxxxxxxxxxxx
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
******************************************
<firstName> Miloslav </firstName>    
<surname>   Nic      </surname>     

<mail>    nicmila@xxxxxxxxx    </mail>   
<support> http://www.zvon.org  </support>
<zvonMailingList> 
    http://www.zvon.org/index.php?nav_id=4 
</zvonMailingList>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.