xsl-list
[Top] [All Lists]

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

2007-01-26 03:06:13
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


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