4

What are the main differences? I couldn't find any complete article. I know only that set of the functions has been extended – e.g date, time etc.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
kacmak7
  • 131
  • 2
  • 9

1 Answers1

12

It is indeed difficult to find either a complete exhaustive list of changes, or a readable summary of the important differences.

Between 1.0 and 2.0 the most significant differences are in the data model and type system, in particular the move to a model where everything is a sequence of items, in which items can be either atomic values or nodes; plus the introduction of many different types of atomic values, based on the XSD (XML Schema) built-in types. Most of the syntax extensions and extensions to the function library can be seen as fleshing out the new types with a set of operations to make them useful. Overall, the language grew by a factor of 2 to 10 depending how you measure it between 1.0 and 2.0, so it's not surprising that listing the changes is difficult.

Between 2.0 and 3.1 the changes are more modest. The Change Logs of the various specifications are a good place to start:

https://www.w3.org/TR/xpath-31/#id-revision-log

https://www.w3.org/TR/2014/REC-xpath-30-20140408/#id-revision-log

https://www.w3.org/TR/xpath-functions-31/#changelog

https://www.w3.org/TR/xpath-functions-30/#changelog

The most significant addition in 3.1 is support for maps and arrays, and hence JSON.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • Thanks for thinking different than the close voters and providing such a great summary! – kjhughes Jul 17 '18 at 12:39
  • Totally agree with @kjhughes One of the most detailed and canonical answer on _xpath_ – undetected Selenium Apr 02 '19 at 12:47
  • What is the (conceptual) difference between a sequence and an array? Would it make sense to think of a sequence as an array? – mstaal Jan 27 '20 at 21:05
  • @Birdie, please don't ask supplementary questions in the form of comments on a previous answer. The StackOverflow format just isn't designed for that. If you have such questions, raise a new question. – Michael Kay Jan 28 '20 at 01:02