How to use starts-with() , contains() and ends-with() in XPath to find the xml node innertext? in XPATH 1.0

前端 未结 1 553
夕颜
夕颜 2020-12-01 17:14

   Ethical standards and patient consent
   Ethical standards and patient
            


        
相关标签:
1条回答
  • 2020-12-01 17:30

    One possible way:

    //Heading[starts-with(., 'Ethical') and ends-with(., 'consent')]
    

    The ends-with() function is XPath 2.0. In XPath 1.0, it can be replaced using substring() and string-length(). Here is the equivalent XPath 1.0 (wrapped for readability):

    //Heading[
                starts-with(., 'Ethical') 
                    and 
                'consent' = substring(., string-length(.) - string-length('consent') +1)
             ]
    
    0 讨论(0)
提交回复
热议问题