Re: [xsl] Re: group together subsequent elements?

Subject: Re: [xsl] Re: group together subsequent elements?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 17 Mar 2012 10:43:19 -0400
At 2012-03-17 15:16 +0100, MatDj Cepl wrote:
On 17.3.2012 12:12, Andrew Welch wrote:
XSLT can do that in several ways, but you will need to provide better
samples covering all of your requirements and edge cases to save going
through the loop.  Do you need a 1.0 solution or can you use 2.0?

Sorry, I should say that I need 1.0 if possible.

When using XSLT 1.0 I've done this by creating a key table assigning to all text nodes the generated identifier of the trigger element to which the text nodes belong.

Then when you encounter a trigger element you can
retrieve all of the text nodes associated with that element.

This also works in XSLT 2.0, but without any
examples from you illustrating various
combinations or scenarios of the kinds of text
aggregation you need, it is impossible for any
volunteer on the list to help you in a substantial way.

Please provide a few samples of your input with
their respective desired output for each.

I hope the above at least helps a bit.

. . . . . . . . . . Ken

p.s. be careful using XSLT 1.0 in Microsoft IE
... the white-space-only text node between two
elements will be unavailable in the data model of
the document and you won't know that it was ignored by their XSLT processor

Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0
Crane Softwrights Ltd.  
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Google+ profile:
Legal business disclaimers:

Current Thread