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

Problems grouping adjacent siblings

Subject: Problems grouping adjacent siblings
From: "Huditsch Roman" <Roman.Huditsch@xxxxxxxxxxxxx>
Date: Thu, 30 Jun 2005 08:37:54 +0200
roman problems
Good morning list,

I would like to group adjacent siblings which share the same local-name
into a container element.

Given this structure

<ax>
  <e></e>
  <r></r>
  <exp>Example</exp>
  <exp>bla bla</exp>
  <exp>jada jada</exp>
  <b></b>
  <e></e>
  <exp>Example 2</exp>
  <exp>bla bla</exp>
  <v></v>
</ax>
<bx>
  <c></c>
  <exp>Example 3</exp>
  <exp>bla bla</exp>
  <b></b>
</bx>

The following output should be produced:

<ax>
  <e></e>
  <r></r>
    <remark>
  	<exp>Example</exp>
  	<exp>bla bla</exp>
  	<exp>jada jada</exp>
    </remark>
  <b></b>
  <e></e>
  <remark>
    <exp>Example 2</exp>
    <exp>bla bla</exp>
  </remark>
  <v></v>
</ax>
<bx>
  <c></c>
  <r></r>
  <remark>
    <exp>Example 3</exp>
    <exp>bla bla</exp>
  </remark>
  <b></b>
</bx>

I thought that this would be the classical use-case for an
<xsl:for-each-group> with @group-adjacent, but I am getting the
strangest results...
I don't even know if it is better to do the grouping in a template
matching
exp[not(preceding-sibling::*[1][local-name()='exp']) or in a template
matching exp's parent
I also tried to find a @group-starting-with solution, since the first
<exp> always starts with the string 'Example'. But with no success
either....
Can you help me with this problem?
Thank you very much for your help!

Wbr,
Roman

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.