xsl-list
[Top] [All Lists]

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

2012-03-17 09:44:47
At 2012-03-17 15:16 +0100, MatÄ?j 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 http://ude.my/uoui9h
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--