Re: [xsl] Grouping repeating elements

Subject: Re: [xsl] Grouping repeating elements
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 11 Jul 2001 11:57:07 +0100
Hi Till,

At 10:12 AM 7/11/01, Trevor wrote:
Have a template matching "name".
In the body of this template create the target <person> element,
copying the matched <name> element, e.g. using copy-of.
To handle elements which always appear, use copy-of with
following-sibling to get the *first* element after the name of the
given type.  Get this working first, and see that 'phil' ends up with
age 28.  Make sure everyone gets just one age!
When you have that XPath right, you now have to add a condition that
the node you find matches the current <name> node and not a later one.
So, add a further condition that the <name> node before the one you
have found is the same node as the one matched in your template: use
preceding-sibling and generate-id().

Have a try at this yourself, if you get stuck ask again.

And after you've got it working, ask again and we'll tell you about the Advanced Technique using keys (the Topic of the Week) to simplify such "levitation" problems (by which I mean making implicit structures explicit)....


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
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:

Current Thread