Monday, February 21, 2022

OIC - How to group data using for each group XSLT 2.0 element

Use case:

Here we will show you how to group data Name element . In the below, we can see Name value is duplicated that we will take distinguish name values using for each group XSLT element.

We will use for-each-group element on Input and group by Name.

Input:

{"Input":[{

"Name": "Sanddy",

"Title":"Title"

},

{

"Name": "Sanddy",

"Title":"Title"

},

{

"Name": "Sanddy2",

"Title":"Title"

}

}]} 

Output:

{"Output":[{

"Greeting": "Hi Sanddy"

},

{

"Greeting": "Hi Sanddy"

}]

}

One sample code:

<xsl:template match="Person">

<xsl:for-each-group select="Student/Info" group-by="@Country">

<Country name="{current-grouping-key()}">

</country>

</xsl:for-each-group>

</xsl:template>

POC with Screenshots:












No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...