RE: Side-effects, state, internal references

Subject: RE: Side-effects, state, internal references
From: Jonathan Marsh <jmarsh@xxxxxxxxxxxxx>
Date: Thu, 16 Apr 1998 12:41:13 -0700
> -----Original Message-----
> From: Norman Walsh [mailto:ndw@xxxxxxxxxx]
> Sent: Thursday, April 16, 1998 11:47 AM
> | One solution might be to build counting behavior directly into the flow
> | objects, such as the HTML <OL> provides.  A more general solution would
> | for XSL to provide counting functions relative to the output tree, e.g.
> | flowObjectChildNumber().
> Those are both possibilities, but it's also possible to simply
> calculate the number correctly from the source grove.  After
> all, if your stylesheet is doing the reordering, it knows what
> reordering it's doing, right? ;-)
I challenge you (in the friendliest way possible :-)) to solve the problem
originally solved in this thread using source-level numbering mechanisms.  I
feel confident that while it is possible, it will be pretty involved,
probably requiring a lot of tree walking from script.

Or alternatively how would you do this correctly?  Given
	<B level="1">first level 1 B</B>
	<B level="2">first level 2 B</B>
	<B level="1">second level 1 B</B>
	<B level="1">third level 1 B</B>
	<B level="2">second level 2 B</B>

I would like this output (the numbers are generated):
	1) first level 1 B
	2) second level 1 B
	3) third level 1 B

In other words, I am filtering out level="2".  This is intended to be a
simple example that shows the general problem of combining numbering with
filtering, reordering or sorting, all of which I expect to be common (nearly
ubiquitous) operations on XML data, and have useful application to XML
documents as well.

> In the reverse case, the proper number for an element in the list

> I've never written a DSSSL stylesheet where I felt that I needed
> either a flow object that could do enumeration automatically or
> the ability to count sosofos.  Which isn't to say that either or
> both of those features might not be useful.
Have you come across this situation in your stylesheets?  I.e. combining
numbering with filtering, reordering or sorting?

 XSL-List info and archive:

Current Thread