xsl-list
[Top] [All Lists]

RE: [xsl] Help Needed On Re-Organizing Structure

2006-04-20 08:34:42
Charles,

You should also look at the technique Jeni Tennison refined back in 2000, in the archives at

http://www.biglist.com/lists/xsl-list/archives/200012/msg00175.html

and also the XSL FAQ at

http://www.dpawson.co.uk/xsl/sect2/flatfile.html

In short, there are, in XSLT 1.0, two methods that are commonly used to approach this problem, which we often label "positional grouping" (elements must be grouped based on their relative positions):

1. "tree visitor" or "forward walk" - this is what Omprakash used. When a "header" element is processed, conduct an explicit traversal of the following-sibling axis, one node at a time, to include all its "child" elements in a group with it.

2. key-based grouping (what Jeni used in the post above): use keys to associate elements with the header element with which they should be grouped. When you do the header, use a key to retrieve the elements that belong with it into the group it makes.

Either technique works. Either can be conducted recursively to achieve multiple levels of grouping.

In XSLT 2.0, the native grouping constructs make all this prestidigitation quite unnecessary. (I'm sorry, but I can't help but think of digital processing as counting on my fingers, really really fast.)

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>
--~--

<Prev in Thread] Current Thread [Next in Thread>