def test_subtransformation():
subtransformation = Transformation(
Rule('*', lib.set_localname('pablo'))
)
transformation = Transformation(
lib.f(id, Ref('root')), lib.put_variable('source_id'),
subtransformation,
lib.f(id, Ref('root')), lib.put_variable('result_id'),
lib.debug_symbols('source_id', 'result_id'),
Rule(Not(If(Ref('source_id'), operator.eq, Ref('result_id'))),
(lib.debug_message('NO!'), lib.debug_symbols('root'),
lib.set_localname('neruda'), AbortRule))
)
doc = etree.fromstring('<augustus />')
assert etree.QName(doc).text == 'augustus'
result = transformation(doc)
assert result.tag == 'pablo'
评论列表
文章目录