I need to use the value of the grandchild provided. I tried but was unable to fetch the value of the grandchild.
This is the xml provided to me
You're pretty close, but there's a couple things here:
xsl-foreach - apply-templates is the better approach./b and in your xsl quotes class="entity'Products element which wraps ProductHere's one way to do this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="InvoiceDocument">
<MessageParts>
<LedgerJournalTable class="entity">
<xsl:apply-templates select="Invoice"/>
</LedgerJournalTable>
</MessageParts>
</xsl:template>
<xsl:template match="Invoice">
<e><xsl:value-of select="normalize-space(a/text()[1])"/></e>
<xsl:apply-templates select="Products/Product"/>
</xsl:template>
<xsl:template match="Product">
<LedgerJournalTrans class="entity">
<g><xsl:value-of select="normalize-space(b/text()[1])"/></g>
<h><xsl:value-of select="normalize-space(c/text()[1])"/></h>
</LedgerJournalTrans>
</xsl:template>
</xsl:stylesheet>
Working fiddle here