I am trying to transform a given XML using xslt. The caveat is that I would have to delete a parent node if a given child node is not present. I did do some template matchin
Super close. Just change your last template to:
Also, it's not incorrect but you can combine your 2 xsl:output elements:
xsl:output