Subject: Re: [xsl] Add a level of structure? From: George Cristian Bina <george@xxxxxxx> Date: Mon, 20 Jun 2005 09:32:35 +0300 |
Best Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
Hello all,
Source xml looks like this, can have between 0-9 c's:
<a>
<b>
<c>
<c1>9</c1>
<c2/>
</c>
<c>
<c1>33</c1>
<c2/>
</c>
<c>
<c1>1</c1>
<c2/>
</c>
<c>
<c1>3</c1>
<c2/>
</c>
<c>
<c1>16</c1>
<c2/>
</c>
<c>
<c1>50</c1>
<c2/>
</c>
</b>
</a>
I need to first sort all the c's based on the value of their c1 child (a
number, and the child always exists with the parent), then, for each three
c's, put them inside another element, which also contains some hard-coded
information that is dependent on the c group. Lastly, there will always be
3 groups, even if there aren't enough c's to justify the group's existence.
So the result needs to look something like:
<foo> <bar> <baz> <!-- since this is the first baz group, add some first-group specific stuff --> <x att="val" att2="val2"/> <y att="val" att2="val2"/> <!-- now the first three c's whose c1 child had the lowest value, in this case 1, 3, and 9 --> <c> <!-- some stuff based on the c whose c1 child was 1 --></c> <c> <!-- some stuff based on the c whose c1 child was 3 --></c> <c> <!-- some stuff based on the c whose c1 child was 9 --></c> </baz> <baz> <!-- since this is the 2nd baz group, add some 2nd-group specific stuff --> <q att="val" att2="val2"/> <r att="val" att2="val2"/> <!-- now the first three c's whose c1 child had the next-lowest value, in this case 16, 33 and 50 --> <c> <!-- some stuff based on the c whose c1 child was 16 --></c> <c> <!-- some stuff based on the c whose c1 child was 33 --></c> <c> <!-- some stuff based on the c whose c1 child was 50 --></c> </baz> <baz> <!-- since this is the 3rd baz group, add some third-group specific stuff --> <g att="val" att2="val2"/> <h att="val" att2="val2"/> <!-- nothing here, but the group, and the hard-coded stuff must appear --> <!-- if there was another 1-3 c's, they'd be in this group --> </baz> </bar> </foo>
I've been for-each-ing and postion()-ing myself to death all day; it's time to ask the Masters.
Thanks for any help
E
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Add a level of structure?, Edmund Mitchell | Thread | Re: [xsl] Add a level of structure?, Sam D. Chuparkoff |
re: [xsl] FOP for MS .NET?, David Preuss | Date | RE: [xsl] preceding/following chara, Andrew Welch |
Month |