Try the following:
/module/component/section[ptemplateId/@root='1.23']
Substituting the ptemplateId / @ root value you want instead of “1.23”, of course. This should cover nested cases if they occur anywhere in the form of children of the section containing this ptemplateId.
You can try this on my online xpath test, here .
Does this work for you?
Edit: You can also consider this option for posting in <xsl:template match="..." />.
<xsl:template match="observation[ancestor::section/ptemplateId/@root = '1.23']"/>