Yorick Peterse
27d2b6c2c3
number() spec for converting empty strings.
2014-08-27 23:52:12 +02:00
Yorick Peterse
7c68f2a49b
Raise for non node sets in the sum() function.
...
According to the XPath spec this function *can only* take node sets, nothing
else. Lets actually enforce that.
2014-08-27 23:47:19 +02:00
Yorick Peterse
ac06670c24
Better conversion of types to numbers.
...
The XPath number() function should also be capable of converting booleans to
numbers, something it previously was not able to do. In order to do this
reliably we can't rely on the string() function as this would make it impossible
to distinguish between literal string values and booleans. This is due to
true(), which returns a TrueClass, being converted to the string "true". This
string in turn can't be converted to a float.
2014-08-27 23:38:47 +02:00
Yorick Peterse
fcb28d5ae8
Specs for various XPath evaluator helper methods.
2014-08-27 23:37:12 +02:00
Yorick Peterse
022d8e0ada
Extra test for sum() for default return values.
2014-08-27 23:07:38 +02:00
Yorick Peterse
30a5d01ebd
Support for the XPath sum() function.
2014-08-27 23:05:04 +02:00
Yorick Peterse
585b3535b2
Support for the XPath lang() function.
2014-08-27 20:26:27 +02:00
Yorick Peterse
10e82de87b
Handle boolean values in predicate results.
2014-08-27 20:26:10 +02:00
Yorick Peterse
7c41fa814f
Default attribute namespaces.
...
When an attribute is prefixed with "xml" the default namespace should be used
automatically. This namespace is not registered on element level by default as
this namespace isn't registered manually, instead it's a "magic" namespace. This
also ensures we match the behaviour of libxml more closely, hopefully reducing
confusion.
2014-08-27 20:24:40 +02:00
Yorick Peterse
d2f991538d
Support for the XPath true()/false() functions.
2014-08-27 09:37:28 +02:00
Yorick Peterse
4ef79bad90
Support for the XPath not() function.
2014-08-27 09:35:02 +02:00
Yorick Peterse
80d235bf06
Don't allow JRuby to fail on Travis anymore.
...
With the recent Racc release the test suite should be green from now on.
2014-08-26 22:00:55 +02:00
Yorick Peterse
338aeeb514
Work around JRuby issue #1923 .
...
String#start_with?() returns false on JRuby when used with an empty string. See
https://github.com/jruby/jruby/issues/1923 for more information.
2014-08-26 21:08:50 +02:00
Yorick Peterse
bcbdf5e4e7
Require at least Racc 1.4.12.
...
This release contains proper JRuby support.
2014-08-26 20:53:36 +02:00
Yorick Peterse
29870c21f2
Use char Arrays in on_call_translate().
...
When running a 1.9 based Ruby Enumerable doesn't have the method #[].
2014-08-26 20:41:16 +02:00
Yorick Peterse
e288ab88f5
Support for the XPath boolean() function.
2014-08-26 20:22:28 +02:00
Yorick Peterse
564f8859a0
Better XPath evaluation tests for numbers.
2014-08-26 20:22:18 +02:00
Yorick Peterse
bcd138a15a
Lexing of explicit negative/positive XPath numbers
2014-08-26 20:21:30 +02:00
Yorick Peterse
8295fa5783
Support for the XPath translate() function.
2014-08-26 18:14:44 +02:00
Yorick Peterse
7f3f626744
Support for the XPath normalize-space() function.
2014-08-26 00:06:58 +02:00
Yorick Peterse
06bed1cfdd
Support for the XPath string-length() function.
2014-08-25 23:46:18 +02:00
Yorick Peterse
a60057db5c
Proper handling of decimals for string() calls.
...
When calling the string() XPath function floats with zero decimals (10.0, 5.0,
etc) should result in a string without any decimals. Ruby converts 10.0 to
"10.0" whereas XPath expects "10".
2014-08-25 23:21:36 +02:00
Yorick Peterse
6c0c5ab720
Revert "Return XPath integers as actual integers."
...
The particular case of string(10) having to return "10" instead of "10.0" will
be handled separately. Returning integers breaks behaviour/expectations
elsewhere.
This reverts commit 431a253000
.
2014-08-25 23:14:22 +02:00
Yorick Peterse
a1a2190fe2
Support for the XPath substring() function.
2014-08-25 23:13:34 +02:00
Yorick Peterse
5382891106
Support for the XPath number() function.
2014-08-25 23:13:03 +02:00
Yorick Peterse
ba058627f2
Corrected docs for on_call_string().
2014-08-25 23:12:45 +02:00
Yorick Peterse
b2ca18e127
Support for the XPath substring-after() function.
2014-08-25 22:19:13 +02:00
Yorick Peterse
b9cdb4a72b
Support for the XPath substring-before() function.
2014-08-25 22:11:05 +02:00
Yorick Peterse
83b873e3c1
Support for the XPath contains() function.
2014-08-25 21:52:33 +02:00
Yorick Peterse
5b65d6c31a
Support for the xpath starts-with() function.
2014-08-25 09:43:06 +02:00
Yorick Peterse
276a5ab83b
Support for lexing empty XPath strings.
2014-08-25 09:42:51 +02:00
Yorick Peterse
b688c6dc1b
Support for the XPath concat() function.
2014-08-23 20:24:18 +02:00
Yorick Peterse
431a253000
Return XPath integers as actual integers.
...
This is to ensure that calls such as string(10) return "10" and not "10.0". It
also saves integer -> float conversions when they're not needed.
2014-08-23 20:22:58 +02:00
Yorick Peterse
b316fd3e1c
Support for the XPath string() function.
2014-08-22 11:06:10 +02:00
Yorick Peterse
ff8a4ad3aa
Ignore comment nodes in NodeSet#text.
2014-08-22 11:05:39 +02:00
Yorick Peterse
99be3182ae
Support for evaluating XPath floats.
2014-08-22 10:59:03 +02:00
Yorick Peterse
6ac3408a71
Match all node types when using node()
...
Previously this would only match element and text nodes.
2014-08-22 10:58:36 +02:00
Yorick Peterse
da09f1296c
Support for using namespace-uri() with attributes.
2014-08-21 22:36:18 +02:00
Yorick Peterse
0d41693bfc
Support for using name() with attributes.
2014-08-21 21:05:06 +02:00
Yorick Peterse
acc056eea4
Support for using local-name() on attributes.
2014-08-21 21:03:28 +02:00
Yorick Peterse
1dd6416bea
Basic support for the XPath name() function.
2014-08-21 20:47:20 +02:00
Yorick Peterse
e7019ceb4c
Renamed context_node to function_node.
2014-08-21 19:06:14 +02:00
Yorick Peterse
8cc0db2283
Support for the XPath namespace-uri() function.
2014-08-21 19:02:41 +02:00
Yorick Peterse
9e20b5ca3e
Support for the XPath local-name() function.
2014-08-21 10:21:02 +02:00
Yorick Peterse
2deb7a6d84
Support for the XPath id() function.
...
This comes with the limitation that it *always* uses the "id" attribute. This is
due to Oga not supporting DTD parsing/evaluation.
2014-08-20 21:06:35 +02:00
Yorick Peterse
d351bc26cc
Support for the XPath count() function.
2014-08-20 10:16:06 +02:00
Yorick Peterse
709fa365e0
XPath support for last() + evaluator docs.
...
I really dislike using a stack as it introduces an internal state. Sadly there
doesn't seem to be an easy way around this.
2014-08-19 22:59:26 +02:00
Yorick Peterse
e0895be675
Better setup for XPath predicates.
...
This allows filtering of nodes by indexes (e.g. using last() or a literal
number) and uses the correct index range (1 to N in XPath). The function
position() is not yet supported as this requires access to the current node,
which isn't passed down the call stack just yet.
2014-08-19 19:56:56 +02:00
Yorick Peterse
202f74a8eb
on_call_last() should return an index, not a node.
2014-08-19 19:56:41 +02:00
Yorick Peterse
423af37422
Basic support for the XPath last() function.
2014-08-18 19:00:32 +02:00