Kar*_*amy 11 xslt xpath xpath-1.0
<ArticleBackmatter>
<Heading>Ethical standards and patient consent</Heading>
<Heading>Ethical standards and patient</Heading>
<Heading>standards and patient consent</Heading>
</ArticleBackmatter>
Run Code Online (Sandbox Code Playgroud)
我希望从"道德"开始获取内部文本,包含"和",并在标题节点中以"同意"结束.
har*_*r07 26
一种可能的方式:
//Heading[starts-with(., 'Ethical') and ends-with(., 'consent')]
Run Code Online (Sandbox Code Playgroud)
该ends-with()功能是XPath 2.0.在XPath 1.0中,可以使用substring()和替换它string-length().这是等效的XPath 1.0(为了便于阅读而包装):
//Heading[
starts-with(., 'Ethical')
and
'consent' = substring(., string-length(.) - string-length('consent') +1)
]
Run Code Online (Sandbox Code Playgroud)