[xsl] How to output open/close tags independently?

Subject: [xsl] How to output open/close tags independently?
From: "Edward L. Knoll" <ed.knoll@xxxxxxxxxxxxxx>
Date: Tue, 24 Dec 2002 12:32:34 -0700
I am creating a XSL stylesheet which effectively copies an input
XML stream to the output and introduces a level of XML elements for a
selected set of elements.   The problem I have run into is that there
does seem to be way to output the open tag of an element separately from
the closing tag.  I've come up with something which works using
<xsl:text> to output the open and close tags; in short, I have to hide
the fact I'm outputting elements.  I am generating well-formed XML,
however, I can't seem to come up with a method which allows the elements
to be recognized as such while keeping the XSL well-formed.

I've included some representative XML at the end of this file.  Note
that there are subelements under the <x> elements in the example.
Additionally, <x> are subelements under another element.  I'm
effectively introducing a new level of element in the middle of an
existing XML element hierarchy.

Is there other recommended methods for doing this?  I'm interested in
general approaches to this type of problem (as opposed to a specific
solution to my specific problem).  Two specific aspects of the problem
I will note are: (a) the new grouping is based on a specified/constant
number of elements (e.g. every N <x> elements are being packaged under a
new element) and (b) I am potentially processing a great number of
elements (e.g. I need an effective solution).

Thanks,
Ed Knoll

p.s. I'm only subscribed to the digest, so if you could reply to me as
well as to the mailing list I'd appreciate it.

INPUT:
<x>...</x>
<x>...</x>
<x>...</x>
<x>...</x>
<x>...</x>
<x>...</x>
<x>...</x>
<x>...</x>
<x>...</x>

OUTPUT:
<w>
<x>...</x>
<x>...</x>
<x>...</x>
</w>
<w>
<x>...</x>
<x>...</x>
<x>...</x>
</w>
<w>
<x>...</x>
<x>...</x>
<x>...</x>
</w>

--
Edward L. Knoll   Phone (work)     : (719)484-2717
                  e-mail (work)    : f49660c@xxxxxxxxxxxxxx
                  e-mail (business): eknoll@xxxxxxxxxx
                  e-mail (personal): edward@xxxxxxxxxxx









 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread