|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Problems grouping adjacent siblings
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








