i need identify cases element contains random text string followed specific child element contains random string. example:
<paragraph>here's text , here's <word>child</word></paragraph> this part of stylesheet, xpath should used.
you're looking following-sibling:: axis.
with xml document:
<root> <paragraph>here's text , here's <word>child</word>.</paragraph> <paragraph>here's text no child.</paragraph> <paragraph>here's text <word>child</word>.</paragraph> <paragraph/> <paragraph>here's text empty <word/>.</paragraph> </root> the following xpath expression selects first, third, , fifth paragraphs:
//paragraph[text()[following-sibling::word]] if want constrain word tag have direct text child, use select first , third:
//paragraph[text()[following-sibling::word[text()]]]
Comments
Post a Comment