I am trying to get a child node value based on a specific parent node value, but I am struggling to get the syntax right…
This is my XML document:
<result>
<heading>A</heading>
<messages>
<message>
<heading>D</heading>
<ingress>ABCD</ingress>
</message>
</messages>
</result>
I am trying to get the ingress “ABCD” when the heading value is A.
This is my code.
<xsl:if test="result">
<xsl:variable name="parent" select="heading"/>
<xsl:value-of select="//message[heading=$parent]"/>
</xsl:if>