Anupam,
At 06:20 PM 9/7/2005, Jay wrote:
Here's one way:
...
<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>
Note that Jay's solution works completely differently from your stated
expectation. He is simply traversing the preceding:: axis to collect all
reg/@counts appearing before the current one, in order to calculate what
its start and end values should be.
That is, where you suggest
So basically output of any node <reg> is based on all the <reg> nodes that
have been processed before it.
Jay silently amends this to read "[the] output of any node <reg> is based
on all the <reg> nodes that *appear* before it".
Notice that this restates the problem in a way that has no dependency on
processing order, but instead refers simply and solely to the organization
of the input.
This is the XSLT way of doing things. Focus on what has to be done and let
the processor figure out how to do it.
This can take some getting used to if you are accustomed to managing the
flow of control yourself (as you must with procedural languages). But it
allows many advantages (including allowing processors to optimize for speed
and efficiency in various ways). And once you're used to thinking this way,
you may even find it easier (some of us think much easier), because the
processor does so much of the work for you.
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--