module RexPath
modifications:
01-Feb-2019: bug fix: new line characters are no longer stripped
between XSL elements bug fix: An attribute variable value is now returned correctly
19-Jan-2018: feature: Implemented Rexslt#to_xml
which returns pretty XML 16-Sep-2017: improvement: all predicates in an xsl:choose
condition now must be true
15-Sep-2017: feature: Implemented xsl_call_template 21-May-2016: bug fix: An update to the Rexle gem regarding the new
Rexle::Element::Attribute datatype caused the sort_by code to break. This has now been rectified.
04-May-2016: bug fix: disabled the method which strips out all new
line spaces, and replaced it with a statement in the read_raw_text() method which strips out space before and after the text
03-May-2016: A returned HTML document will no longer include an
XML declaration by default
30-Apr-2016: bug fix: This class can now be executed within an
eval statement which runs within another class
24-Apr-2016: The position() function is now supported within an
xsl:value-of select attribute An xsl:attribute value can now be rendered using an xsl:text element
Public Instance Methods
attribute_scan(node)
click to toggle source
# File lib/rexslt.rb, line 40 def attribute_scan(node) result = '' attr = %w(id class).detect {|x| node.attributes.has_key? x} if attr then value = node.attribute[attr] result = "[@%s='%s']" % [attr, value] end result end
doc_scan(node, option=nil)
click to toggle source
# File lib/rexslt.rb, line 50 def doc_scan(node, option=nil) name = node.name attribute = option == :no_cond ? '' : attribute_scan(node) result = doc_scan(node.parent,option) unless node.root === node.doc_root [result, name.to_s + attribute] end
to_xpath(option=nil)
click to toggle source
# File lib/rexslt.rb, line 39 def to_xpath(option=nil) def attribute_scan(node) result = '' attr = %w(id class).detect {|x| node.attributes.has_key? x} if attr then value = node.attribute[attr] result = "[@%s='%s']" % [attr, value] end result end def doc_scan(node, option=nil) name = node.name attribute = option == :no_cond ? '' : attribute_scan(node) result = doc_scan(node.parent,option) unless node.root === node.doc_root [result, name.to_s + attribute] end doc_scan(self, option).flatten.compact.join('/') end