Support for the XPath string-length() function.

This commit is contained in:
Yorick Peterse committed 2014-08-25 23:46:18 +02:00
1 parent a60057db5c
commit 06bed1cfdd
2 files changed
+58

No files matched your search

+16
View File
@@ -966,6 +966,22 @@ module Oga
return haystack_str[start_index..stop_index]
end
##
# Processes the `string-length()` function.
#
# This function returns the length of the string given in the 1st argument
# *or* the current context node. If the expression is not a string it's
# converted to a string using the `string()` function.
#
# @see [#on_call_string]
# @param [Oga::XML::NodeSet] context
# @param [Oga::XPath::Node] expression
# @return [Float]
#
def on_call_string_length(context, expression = nil)
return on_call_string(context, expression).length.to_f
end
##
# Processes an `(int)` node.
#