At 99/11/05 08:07 -0700, George Martell wrote:
The problem is that, upon changing from XSL to XSLT, my xsl stylesheets no
longer support the use of "counter" and "counter-increment." How can I
regain the counter feature?
I had to rewrite my stylesheets rethinking the approach to utilize
position() and <xsl:number> ... this wasn't initially easy because not all
templates were being invoked with the appropriate node set to produce the
correct values for position(), but the fact that <xsl:number> is based on
the source node tree meant it was sometimes easier to use that (though my
select="expression" attribute sometimes was a bit complex qualifying the
nodes being counted).
But, though I found no rule of thumb, in the end it turned out it wasn't
difficult, just a matter of thinking of the problem differently. Being
classically trained in programming, counters were easy to use. Trying to
think in the new approach without being caught in classical concepts was
difficult, but the actual use of position() and <xsl:number> turns out to
be straightforward if you keep your mindset away from the "old" way of
doing things.
While I haven't given you a "replacement" for counter, I hope the above
gives some direction on how to look at a different approach. Just think of
those constructs you have relative to the set of nodes being processed and
the nodes' locations in the source node tree.
............ Ken
p.s. one thing I did while doing the conversion was to just comment out the
use of the counter constructs until I had debugged the use of position()
and <xsl:number> ... that way if I did have a problem, I didn't have to
rethink what the old counter solution was, I just looked in the comments at
my use of the old constructs ... once I was up and running and fully
debugged, I removed the comments.
--
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/m/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath ISBN 1-894049-02-0
Next instructor-led training: 1999-11-08, 1999-11-09, 1999-12-05/06,
- 1999-12-07, 2000-02-27/28, 2000-05-11/12, 2000-05-15
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list