Naturally if there are more than one <l> you can limit to first <l> with position() xmllint.exe --xpath " //header[ contains(.,'rationale') ]/node()[ following-sibling::l[ position()=1 ] or self::l[ position()=1 ] ] " fudge