Project

General

Profile

« Previous | Next » 

Revision 3797

xml_func.py: _ref(): Only display "XPath reference target missing" warning if target node does not exist, not if it exists but is empty

View differences:

lib/xml_func.py
153 153
    try: addr = items['addr']
154 154
    except KeyError, e: raise SyntaxError(e)
155 155
    
156
    value = xpath.get_value(node.parentNode, addr)
157
    if value == None:
156
    target = xpath.get_1(node.parentNode, addr)
157
    if target != None: value = xml_dom.value(target)
158
    else: 
158 159
        warnings.warn(UserWarning('_ref: XPath reference target missing: '
159 160
            +str(addr)))
161
        value = None
162
    
160 163
    return value
161 164
funcs['_ref'] = _ref
162 165
structural_funcs.add('_ref')

Also available in: Unified diff