@@ 1,3 1,8 @@
+2022-09-05:
+
+* add default namespaces also in XPath expressions containing `and` or `or`
+* bump version to 2.11
+
2022-05-11:
* add options `-p` (`--pis`) and `-P` (`--comments`)
@@ 1,6 1,6 @@
#!/usr/bin/python3
# xgrep.py -- search for elements in XML files, using XPath 1.0 expressions
-# Andreas Nolda 2022-05-11
+# Andreas Nolda 2022-09-05
import sys
import argparse
@@ 8,7 8,7 @@ import re
from blessings import Terminal
from lxml import etree
-version = "2.10"
+version = "2.11"
parser = argparse.ArgumentParser()
parser.add_argument("expr",
@@ 65,6 65,8 @@ def insert_default_ns(expr, nsmap):
"[a-z-]+\(|" # function(
",|" # ,
"\)|" # )
+ "\s+and\s+|" # and
+ "\s+or\s+|" # or
"\]" # ]
")",
expr)