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

OIC - Removing Base64 Padding (=) for JWT Generation in Oracle Integration Cloud (OIC)

When generating a JWT in Oracle Integration Cloud (OIC), the header and payload must be Base64URL encoded before creating the signature. Sta...