# File tailor.rb, line 98 def process_import(xml_context, eval_context) elements = REXML::XPath.match(xml_context, './/*[@import]') elements.each do |element| import = element.attributes['import'].strip xpath = element.attributes['xpath'].strip if element.attributes.has_key?('xpath') import_file, import_context = import.split('#') import_file.strip! import_context.strip! if import_context import_rxtal = Tailor.new(import_file) import_rxtal.process if import_context context_element = REXML::XPath.first(import_rxtal.xml_document, ".//*[@importable='#{import_context}']") if xpath import_nodes = REXML::XPath.match(context_element, xpath) else import_nodes = [context_element] end else if xpath import_nodes = REXML::XPath.match(import_rxtal.xml_document, xpath) else import_nodes = [import_rxtal.xml_document.root] end end import_nodes.each do |import_element| import_element.attributes.get_attribute('importable').remove if import_element.attributes.has_key?('importable') element.parent.insert_before(element, import_element) end element.remove end end