Commit c8c79fa3 authored by Neeme Kahusk's avatar Neeme Kahusk

xpath v.2

parent 99e2a13c
\ No newline at end of file
\ No newline at end of file
......@@ -18,7 +18,7 @@ csv.register_dialect('vrt_dialect', delimiter = '\t',
ATS = ['simplepath', 'attrs', 'xpath', 'example', 'source', 'path']
ATS = ['label_et','simplepath', 'attrs', 'xpath', 'example', 'source', 'path']
def make_simplepath(path: str):
......@@ -27,7 +27,7 @@ def make_simplepath(path: str):
return out
def make_xpath(path: str, attrs: dict):
nsita = re.sub(r'([{])([^}]+)([}])',r'\1*\3',path)
nsita = re.sub(r'([{])([^}]+)([}])',r'x:',path)
out = re.sub('[[][^]]+[]]','','.//' + nsita)
if attrs:
out = out + '[@{}="{}"]'.format(*attrs.items()[0])
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment