XSLT 2.0 - Group by partial value of an attribute

Here should go questions about transforming XML with XSLT and FOP.
msambasiva
Posts: 87
Joined: Tue Jul 17, 2018 6:57 am

XSLT 2.0 - Group by partial value of an attribute

Post by msambasiva »

Hi,
We are using XSLT 2.0.

We have a requirement to group the services based on product which is part of an attribute value. Below is the part of xml taken to brief you the requirement.

In the below xml, there are three services. Two services are from commonWorkExecution prodcut.

The expected output is as follows
Product(Level 1) Service (Level 2)
commonWorkExecution
Work Order Material Transaction Service
Work Order Operation Transaction Service
orderPromising
Order Promising Service
<services>

<chapterSummary>
<text>This chapter describes the SOAP web services available for abc Sales Cloud.</text>
</chapterSummary>
<service anchor="abc.apps.scm.orderPromising.orderPromising.orderPromisingServiceV2.OrderPromisingService"/>
<service anchor="abc.apps.scm.commonWorkExecution.workOrderMaterialTransactions.materialTransactionsService.WorkOrderMaterialTransactionService"/>
<service anchor="abc.apps.scm.commonWorkExecution.operationTransactions.operationTransactionsService.WorkOrderOperationTransactionService"/>

Any clue would be really great help.

Thanks,
Samba.
Radu
Posts: 9053
Joined: Fri Jul 09, 2004 5:18 pm

Re: XSLT 2.0 - Group by partial value of an attribute

Post by Radu »

Hi,

Maybe you can use the XSL for-each-group:

https://www.w3.org/TR/xslt20/#grouping

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply