Oxygen XML Editor
 
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Wrap changing element sequence into container: with 'for-each-group'?


Subject: [xsl] Wrap changing element sequence into container: with 'for-each-group'?
From: Yves Forkl <Y.Forkl@xxxxxx>
Date: Fri, 26 Jan 2007 11:05:50 +0100

Given two XML fragments

<a>
 <b1/>
 <b2/>
 <c/>
</a>

and

<a>
 <b2/>
 <c/>
</a>

I would like to wrap <b1/><b2/> into a <b/> container, and the same should happen to <b2/> when occurring alone. The other elements can be assumed to remain unchanged.

While I found quite some hints on solving grouping problems in the XSLT FAQ and in the XSL list archive, I can't figure out how to solve this wrapping task using XSLT 2.0. There is an interesting posting here: http://www.biglist.com/lists/xsl-list/archives/200201/msg00804.html
But I don't know how this could serve as a basis for a solution to my problem.


I suspect that "for-each-group" should be my friend; how would I need to use it here? Or is there any other, more elegant solution?

Yours,

Yves


Current Thread
 
© 2002-2008 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy
This website was created & generated with <oXygen/> XML Editor
Keywords