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

Re: How to do this without updating a variable?

Subject: Re: How to do this without updating a variable?
From: "Agnisys Technology \(P\) Ltd." <agnisys@xxxxxxxxx>
Date: Thu, 8 Sep 2005 10:54:50 -0700 (PDT)
Re:  How to do this without updating a variable?
Yeah this is much more elegant. A useful way to thing about this problem (for me atleast) is to
think that the datastructure is already there, to create the output I just have to traverse it
based on what information I need.
Slowly, I'm getting used to this new way of thinking ...

Thanks to Jay and Mukul for additional help.
Anupam.

--- JBryant@xxxxxxxxx wrote:

> A little more thinking reveals that:
> 
> <xsl:choose>
>   <xsl:when test="position() = 1">
>     <tr>
>       <td><xsl:value-of select="."/></td>
>       <td>1</td>
>       <td><xsl:value-of select="@count"/></td>
>     </tr>
>   </xsl:when>
>   <xsl:otherwise>
>     <tr>
>       <td><xsl:value-of select="."/></td>
>       <td><xsl:value-of select="sum(preceding::reg/@count) + 1"/></td>
>       <td><xsl:value-of select="sum(preceding::reg/@count) + 
> @count"/></td>
>     </tr>
>   </xsl:otherwise>
> </xsl:choose>
> 
> 
> can be just:
> 
> <tr>
>   <td><xsl:value-of select="."/></td>
>   <td><xsl:value-of select="sum(preceding::reg/@count) + 1"/></td>
>   <td><xsl:value-of select="sum(preceding::reg/@count) + @count"/></td>
> </tr>
> 
> because the sum of the empty set will be 0.
> 
> Jay Bryant
> Bryant Communication Services
> (presently consulting at Synergistic Solution Technologies)
> 
> 



	
		
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/

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.