Example #1
0
 def evaluate_i(self, static, dynamic, local):
     value = utils.get_single(self.value.evaluate(static, dynamic, local))
     reference = utils.get_single(self.reference.evaluate(static, dynamic, local))
     if isinstance(self.position, Production):
         position = self.position.evaluate(static, dynamic, local)
         position = utils.get_single_instance(position, d.Number).get_as_int()
     else:
         position = self.position
     return utils.singleton(d.StandardInsert(value, reference, position))
Example #2
0
File: data.py Project: hzmmzl/afn
 def get_for_indexer(self, value):
     index = utils.get_single_instance(value, Number).get_as_int()
     this_value = self.get_value()
     if index < 0 or index >= len(this_value):
         return EmptySequence()  # or raise an exception? Check on XQuery's behavior for this
     return StandardSequence([StandardString(this_value[index])])
Example #3
0
def print_(dynamic, value):
    print utils.get_single_instance(value, d.String).get_value()
Example #4
0
def position(dynamic, check=None):
    if check is None:
        return utils.create_number(dynamic.context_position)
    return utils.create_boolean(
            utils.get_single_instance(check, d.Number).get_as_int() == dynamic.context_position)