<module>
<component>
<section>
<ptemplateId root="1.8"/>
<entry>
<observation>
<templateId root="1.24"/>
</observation>
</entry>
</section>
</component>
<component>
<section>
<ptemplateId root="1.10"/>
<entry>
<observation>
<templateId root="1.24"/>
</observation>
</entry>
</section>
</component>
<component>
<section>
<ptemplateId root="1.23"/>
<entry>
<observation>
<templateId root="1.24"/>
</observation>
<entryRelation>
<observation>
<templateId root="1.24"/>
</observation>
</entryRelation>
</entry>
</section>
</component>
<component>
<section>
<ptemplateId root="1.8"/>
<entry>
<observation>
<templateId root="1.24"/>
</observation>
<entryRelation>
<observation>
<templateId root="1.28"/>
</observation>
</entryRelation>
</entry>
</section>
</component>
</module>
I would like to select observation in a template based on ptemplateId, can i know the match expression for this ?
<xsl:template match"******">
<!-- some processing goes here to process
observation if ptemplateId is 1.8... -->
</xsl:template>
<xsl:template match"******">
<!-- some processing goes here to process
observation if ptemplateId is other than 1.8... -->
</xsl:template>
there can be nested observation's also. (i am looking for a match expression with axis expressions to make it more generic)
Try this:
Substituting the ptemplateId/@root value that you want instead of ‘1.23’, of course. This should cover nested observations, so long as they occur anywhere as children of the section that contains that ptemplateId.
You can try this out at my online xpath tester, here.
Does this work for you?
Edit: You may also consider this variant, for placing into an
<xsl:template match="..." />.