I'm trying to insert a ServerName directive after the corresponding comment in httpd.conf:
#ServerName www.example.com:80
This fails:
defvar sncomment /files/etc/httpd/conf/httpd.conf/#comment[.= 'ServerName www.example.com:80']
ins directive after $sncomment
defvar snentry /files/etc/httpd/conf/httpd.conf/directive[preceding-sibling::*[1][$sncomment]]
set $snentry 'ServerName'
set $snentry/arg 'www.domain:80'
$sncomment matches the correct line and a blank directive is inserted at the correct point in the tree but $snentry matches every directive in the tree not just the one inserted. How can I match only the inserted directive?
Thanks