cancel
Showing results for 
Search instead for 
Did you mean: 

Remove nodes without child fields in SAP HCI

Wes_Ancog
Explorer
0 Kudos

<Root>
<Emp>
<PersonId>10001</PersonId>
<Child/>
<Child>
<F1>JOE DOE</F1>
<F2>SGP</F2>
<F3>2010-01-06</F3>
</Child>
<Child/>
<Child>
<F1>Peter Parker</F1>
<F2>AFG</F2>
<F3>2012-05-30</F3>
</Child>
<Child>
<F1>Chris Tiu</F1>
<F2>SGP</F2>
<F3>2012-01-26</F3>
</Child>
</Emp>

<Root>

Id like to remove all <Child> nodes without values

View Entire Topic
Sriprasadsbhat
Active Contributor
0 Kudos

Hello Aenan,

Add a XSLT mapping with below code then it should work.

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" encoding="Windows-1252" indent="yes"/>
	<xsl:template match="@*|node()[./node()]">
		<xsl:copy>
			<xsl:apply-templates select="@*|node()"/>
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>

Regards,

Sriprasad Shivaram Bhat