[Home] [By Thread] [By Date] [Recent Entries]
Allison,
Yours is a version of a semi-FAQ, which you will find addressed at http://www.dpawson.co.uk/xsl/sect2/flatfile.html . Actually, recursion isn't the easiest solution. It's to "prewire" the hierarchy you want with keys. It's easiest to think of the wiring from bottom up. It sounds from your description like your lowest level is C, which are directly inside their most-previous A (or possibly P, whichever is more recent). This relation can be established with <xsl:key name="Records-by-parent" match="Record[F1='C']"
use="generate-id(preceding-sibling::Record[F1='A' or F1='P'][1])"/>The way this key works is, if I give it the value of a string, it will return for me all C records that "belong to" (are intended to be children of) any P or A record whose generated unique ID equals my string. Likewise, <xsl:key name="Records-by-parent" match="Record[F1='A']"
use="generate-id(preceding-sibling::Record[F1='P'][1])"/>gets me back A records from the ID of a P record. I build my hierarchy by pulling out all my P records, then inside each P record's element, getting all the A and C records that belong to it (using the ID of the P record as the key to retrieve them), then inside the As, getting all the C records that belong to them. Sort of recursion inside out, if you like. I hope between this synopsis and the FAQ (more code), you can see what you have to do. If not, ask again. Good luck, Wendell At 03:37 PM 6/10/2002, you wrote: Hello, ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx 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
|

Cart



