lib/xpath/renderer.rb in xpath-1.0.0.beta1 vs lib/xpath/renderer.rb in xpath-1.0.0
- old
+ new
@@ -133,9 +133,19 @@
else
"#{current}/following-sibling::*[1]/self::*"
end
end
+ def previous_sibling(current, element_names)
+ if element_names.length == 1
+ "#{current}/preceding-sibling::*[1]/self::#{element_names.first}"
+ elsif element_names.length > 1
+ "#{current}/preceding-sibling::*[1]/self::*[#{element_names.map { |e| "self::#{e}" }.join(" | ")}]"
+ else
+ "#{current}/preceding-sibling::*[1]/self::*"
+ end
+ end
+
def inverse(current)
"not(#{current})"
end
def string_function(current)