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
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
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
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
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
423af37422
Basic support for the XPath last() function.
2014-08-18 19:00:32 +02:00
Yorick Peterse
2817784e6b
Support for the XPath pipe operator.
2014-08-17 22:04:08 +02:00
Yorick Peterse
d1735750c1
Only store unique nodes in XML::NodeSet.
...
It's called a "set" after all.
2014-08-17 22:03:44 +02:00
Yorick Peterse
bb503728af
XPath support for processing instructions.
2014-08-16 22:37:57 +02:00
Yorick Peterse
0d7609da88
Support for parsing XML processing instructions.
2014-08-15 22:23:26 +02:00
Yorick Peterse
8f4eaf3823
Lexing of XML processing instructions.
2014-08-15 22:04:45 +02:00
Yorick Peterse
ccd95d69d8
Support for the XPath comment() test.
2014-08-15 20:49:13 +02:00
Yorick Peterse
4e8cca258c
Fixed lexing of XML CDATA tags.
2014-08-15 20:47:58 +02:00
Yorick Peterse
81edce2eb8
Fixed lexing of XML comments.
...
The previous setup would consume too much. For example the following HTML:
<a><!--foo--><b><!--bar--></b></a>
would result in the following T_COMMENT token:
"foo--><b><!--bar"
The new setup requires the marking of a start position. I'm not a huge fan of
this but there doesn't appear to be a way around this.
2014-08-15 20:42:32 +02:00
Yorick Peterse
4d7f224892
Support for the XPath text() type test.
2014-08-15 10:46:00 +02:00