Robert,
At 10:45 PM 10/7/2006, you wrote:
If you think that code includes some peculiar things, you should have
seen some of the things I tried. I've never worked so hard with so
little return in my life...but, like Barkus, I'm willing.
If it's any comfort, please understand that grouping is #1 on the
list of applications that are not trivially easy in XSLT 1.0 and yet
that beginners nevertheless try to start with. It's like a novice
carpenter setting out to build cabinetry before learning to frame
boxes and hang shelves....
Grouping is an "up-transformation" in the sense that it adds
information to a document that is not fully explicit already in the
markup. But XSLT 1.0 was designed to provide transformations with the
goal of formatting, not of truly arbitrary rearrangements of source
documents; its assumption is that XSL's job is to provide
presentational markup for XML input that is *already grouped*. That
XSLT is used so commonly for tasks such as grouping is actually an
indication that it's really good at what it does -- so people then
apply it to other things it's not really good at doing.
Largely in order to deal with this trend in XSLT's usage, XSLT 2.0
has responded to the needs of users in regard to this as well as to
other functionalities. If you can use XSLT 2.0 for your grouping
you'll find it's much easier.
If you have no choice but to use XSLT 1.0, you might find,
paradoxically, the best approach to solving a grouping problem is to
set it aside and use the language for a while on other problems
(maybe with the same input data) that are more straightforwardly
solved, to gain some familiarity with the basic processing model and
methodologies before getting into the more complex task. (Not
everyone has this luxury unfortunately.) This would help ween you
from ideas that don't really belong ("looping" through the nodes),
and give you a basis for understanding some of the subtler things
that might not make a difference except when they do (using a
for-each vs using templates).
Assuming you're game (as you say you are), the best way to get help
here (as always) is to isolate the exact question you have into a
minimal demonstration, and post just that. Even doing that exercise
will teach you a great deal, even apart from the answers you then get.
Cheers,
Wendell
--~------------------------------------------------------------------
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>
--~--