<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>
Run Code Online (Sandbox Code Playgroud)
我想在基于ptemplateId的模板中选择观察,我能知道匹配表达式吗?
<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)
Run Code Online (Sandbox Code Playgroud)
试试这个:
/module/component/section[ptemplateId/@root='1.23']//observation
Run Code Online (Sandbox Code Playgroud)
当然,用你想要的ptemplateId/@ root值代替'1.23'.这应该涵盖嵌套的观察,只要它们出现在包含该ptemplateId的节的子节点的任何地方.
你可以在我的网上的XPath测试尝试了这一点,在这里.
这对你有用吗?
编辑:你也可以考虑这个变种,放入<xsl:template match="..." />
.
<xsl:template match="observation[ancestor::section/ptemplateId/@root = '1.23']"/>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10481 次 |
最近记录: |