[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xsl:for-each-group help needed !

Subject: xsl:for-each-group help needed !
From: "Christophe Marchand cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 16 Sep 2020 21:19:14 -0000
 xsl:for-each-group help needed !
Hello all !

A slide is divided as blocks. Usually, there is one bloc per line, but sometimes, two or more blocks can be on one line, if their width sum is 100.

My input has non-grouped blocks, and I want my input group blocks per line.

Here is a sample input :

B  <block id="i1">content</block>
B  <block id="i2" width="33">content</block>
B  <block id="i3" width="67">content</block>
B  <block id="i4" width="50">content</block>
B  <block id="i5" width="50">content</block>
B  <block id="i6" width="25">content</block>
B  <block id="i7" width="55">content</block>
B  <block id="i8" width="20">content</block>
B  <block id="i9">content</block>

Here is the expected output :

B  <block id="i1">content</block>
B  <block type="composite">
B  B  <block id="i2" width="33">content</block>
B B B  <block id="i3" width="67">content</block>
B  </block>
B  <block type="composite">
B  B  <block id="i4" width="50">content</block>
B B B  <block id="i5" width="50">content</block>
B  </block>
B  <block type="composite">
B  B  <block id="i6" width="25">content</block>
B B B  <block id="i7" width="55">content</block>
B  B  <block id="i8" width="20">content</block>
B  </block>
B  <block id="i9">content</block>

I have no idea of which form of for-each-group I have to use...

Is a solution with two-pass where I first calculate cumulated width with an accumulator, followed a group-end-with="@cumulative-width eq 100" could be a correct solution ?


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.