Module: Transform
Overview
All public methods can be invoked by a transform element; please hide methods you don’t want users to invoke in Private
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#content(path) ⇒ String
Content of target node.
-
#copy(path) ⇒ Element
A deep copy of the target(s).
-
#element(*args) ⇒ Element
New element to replace old one.
-
#find_source(node) ⇒ Element
XML node that provided content for transformation i.e.
-
#find_transform(node) ⇒ Element
XML node that contains instructions for transform used to create given @param node.
-
#find_xform_event(node) ⇒ TransformClass
Transform event object from output Doc’s history.
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
15 16 17 |
# File 'lib/con_duxml/transform.rb', line 15 def source @source end |
Instance Method Details
#content(path) ⇒ String
Returns content of target node.
38 39 40 |
# File 'lib/con_duxml/transform.rb', line 38 def content(path) @source.locate(add_name_space_prefix path).first.text end |
#copy(path) ⇒ Element
Returns a deep copy of the target(s).
51 52 53 54 55 |
# File 'lib/con_duxml/transform.rb', line 51 def copy(path) @source.locate(add_name_space_prefix path).collect do |node| node.dclone end end |
#element(*args) ⇒ Element
Returns new element to replace old one.
45 46 47 |
# File 'lib/con_duxml/transform.rb', line 45 def element(*args) Element.new(*args) end |
#find_source(node) ⇒ Element
Returns XML node that provided content for transformation i.e. source.
31 32 33 |
# File 'lib/con_duxml/transform.rb', line 31 def find_source(node) find_xform_event(node).input end |
#find_transform(node) ⇒ Element
Returns XML node that contains instructions for transform used to create given @param node.
25 26 27 |
# File 'lib/con_duxml/transform.rb', line 25 def find_transform(node) find_xform_event(node).instructions end |
#find_xform_event(node) ⇒ TransformClass
Returns transform event object from output Doc’s history.
19 20 21 |
# File 'lib/con_duxml/transform.rb', line 19 def find_xform_event(node) @output.history #TODO find transform whose outputs include given node end |