IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Grouping on field value Options · View
henkleppers
Posted: Monday, November 12, 2018 2:13:26 PM
Rank: Newbie

Joined: 11/12/2018
Posts: 2
Location: Weert
Hi,

I want to generate an XSLT that transforms XML 1 (zie attachment) to XML 2.

Grouping on invoice needs to be done when FIELD1=0, that's where the lines for a new invoice start. All lines up untill the next FIELD1=0 are 1 invoice.
The sample XML contains 2 invoices. How do I group this?

Shortened example:


<items>
<item>
<FIELD1>0</FIELD1>
</item>
<item>
<FIELD1>1</FIELD1
</item>
<item>
<FIELD1>2</FIELD1
</item>

<item>
<FIELD1>0</FIELD1>
</item>
<item>
<FIELD1>1</FIELD1
</item>
<item>
<FIELD1>2</FIELD1
</item>
and so on..
<items>

has to transform to:


<items>
<INVOICE>
<item>
<FIELD1>0</FIELD1>
</item>
<item>
<FIELD1>1</FIELD1
</item>
<item>
<FIELD1>2</FIELD1
</item>
</INVOICE>


<INVOICE>
<item>
<FIELD1>0</FIELD1>
</item>
<item>
<FIELD1>1</FIELD1
</item>
<item>
<FIELD1>2</FIELD1
</item>
</INVOICE>



<items>

File Attachment(s):
2.xml (55kb) downloaded 335 time(s).
1.xml (55kb) downloaded 320 time(s).


island
Posted: Tuesday, November 13, 2018 10:23:45 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Try using the "group-starting-with" function


island attached the following image(s):
group-starting-with.png

henkleppers
Posted: Tuesday, November 13, 2018 1:40:51 PM
Rank: Newbie

Joined: 11/12/2018
Posts: 2
Location: Weert
Thnx, that did the trick!
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.