Re: [xsl] attributes to nested element problem

Subject: Re: [xsl] attributes to nested element problem
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 20 May 2004 11:05:05 -0400

At 06:50 PM 5/19/2004, you wrote:
Thanks for all your quick responses! I was grappling with this for a while yesterday... a lot more difficult than I would have thought... Wendall I'll have to study your one a bit to get my head around it...

I've barely got my own head around it, so you're in good company. (At least I hope you consider me to be good company.)

The basic idea is that since processing the attributes serially would ordinarily result in serial output (whatever the attributes turned into would be next to each other, not nested), we process them as a group. That's what the recursive template does, taking each attribute in turn and saying "okay, wrap the results of processing the rest of the attributes in the group in an element, as dictated by the template matching this attribute", continuing this until there are no attributes left. Since the @paragraph attribute has to be done first, we handle that one explicitly before we run the recursive process on the rest of them.

It's not using templates as envisioned in the basic XSLT processing model (notice how the RTF representing the contents of each element created for each attribute in turn has to be passed in as a parameter); but since we can pass parameters around bound to node sets (the set of attributes) or to result-tree-fragments (the results of processing each attribute, or for that matter of processing the contents of the <label> element node), we can do this.

and I guess I'll have to wait for 2.0 for the nicer solution....

xsl:next-match is going to make lots of stuff easier. And that technique allows you (requires you) to determine the order in which you want the attributes nested -- something you can control only painfully in the 1.0 solution.


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

Current Thread