[Xpath-ng] Proposal for definition of values/lists
Uche Ogbuji
uche.ogbuji at fourthought.com
Mon Dec 9 16:41:16 MST 2002
I am very impressed with the activity. Not I'm just franticvally struggling
to catch up...
> Hi,
>
> I propose that we define values in XPath NG as follows:
>
> Every value in XPath NG is a list or an atom. A list is a sequence
> of zero or more values. Atoms are of two kinds: nodes and data.
> Nodes are atoms that have identity whereas data are atoms that do
> not have identity.
This is similar to our approach in Versa, and I think sound. I also think we
should provide a simple one-way mapping from XPath 1.0, which I think is easy
enough.
> [Issue: Should we have node sets instead of generic lists?]
I think generic lists are far more useful, in general.
> [Issue: Should we allow only flattened lists rather than allowing
> lists to hold lists?]
I move for lists of lists.
> [Issue: Should we allow heterogeneous lists or only allow lists
> whose items are all nodes, all atoms or all lists?]
I move for homogeneous lists to start, purely for implementation
considerations in languages without strong generics (Java?)
Heterogeneous is probably more useful, but not as much so, IMO as the list of
lists facility.
Note: some of the most important uses of heterogeneous lists can be covered on
top of the layer that adds generic node properties. After all, XPath NG nodes
+ Properties module would really give us full dynamic strucures.
So that makes me wonder whether node properties should be XPath NG core.
> [Issue: Are there better terms for "value", "list", "atom" and/or
> "data"?]
I like "atom".
> There are three core types of data in XPath NG: strings, numbers and
> booleans. These atoms can be cast to each other using the XPath 1.0
> rules. The only difference is that in XPath NG, strings that hold
> numbers in scientific notation can be cast to numbers, 'INF' is
> converted to infinity and '-INF' is converted to negative infinity.
>
> [Issue: Do we want another definition for numbers?]
I think we should stick to XPath 1.0 numbers.
> [Issue: Should the string "false" cast to boolean false?]
I don't like this. I'd say no.
> Lists are cast to strings and numbers by converting the first value
> in the list to a string or number; if the list is empty you get an
> empty string or NaN. Lists are cast to boolean true if they contain
> any values, boolean false if they do not.
>
> [Issue: Should lists be converted to strings by concatenating the
> string value of each value, with spaces as separators?]
I'd make this a separate function.
> Other modules may add more data types, but every data type must
> define a mapping onto strings, numbers and booleans, and the module
> must describe how that data type is created from a sequence.
>
> [Issue: Do we need any more built-in data types?]
I'd say no.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html
Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html
RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p
yth11.html
Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb
ugxs.html
More information about the Xpath-ng
mailing list