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

RE: Finding the maximum number of nodes (Redux)

Subject: RE: Finding the maximum number of nodes (Redux)
From: "McKeever, Marty" <marty.mckeever@xxxxxxxxxxxxxxxxx>
Date: Wed, 03 Oct 2001 11:06:26 -0400
finding the maximum number
of the two, i certainly prefer your solution.  It is much simpler to write
and understand.
but as a mental exercise (something to do on my lunch break), i wanted to
see if i could create a single XPath statement that would do the job.  I
nearly bit off more than i could chew!

Now that it "works", i'm just wondering if anyone can verify the logic
behind it.  I'm still not certain that I even understand "why" it works...

Thanks for the code tho -- good stuff.

Marty

> -----Original Message-----
> From: Jörg Heinicke [mailto:joerg.heinicke@xxxxxx]
> Sent: Wednesday, October 03, 2001 10:35 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Finding the maximum number of nodes (Redux)
> 
> 
> > <xsl:attribute name="colspan"><xsl:value-of 
> select="count(tr[count(td)
> &gt;
> > count(following-sibling::tr[count(td) &gt;
> > count(preceding-sibling::tr[last()]/td)]/td)][count(td) &gt;
> > count(preceding-sibling::tr[last()]/td)]/td)"/></xsl:attribute>
> 
> This would be unacceptable for me - who should understand that later?
> 
> Why not something like that:
> 
> <xsl:template match="table">
> <xsl:variable name="cols">
>     <xsl:for-each select="tr">
>         <xsl:sort select="count(td)"/>
>         <xsl:if test="position()=last()">
>             <xsl:value-of select="count(td)"/>
>         </xsl:if>
>     </xsl:for-each>
> </xsl:variable>
> <table border="1">
> <tr>
> <td colspan="{$cols}">Table Header Text</td>
> </tr>
> <xsl:copy-of select="tr"/>
> </table>
> </xsl:template>
> 
> Joerg
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 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.