According to the XPath specifications are constructor
functions and the cast
expression defined to be semantically equivalent. I wonder,
why then provide
both?
There were two reasons for retaining the "cast as" syntax after constructor
functions were introduced:
(a) "cast as" gives you the choice of whether to allow an empty sequence as
the operand (returning an empty sequence as the answer) or not.
(b) constructor functions aren't available for types whose names are in no
namespace, unless you want to namespace-qualify all system functions with
fn: (e.g. fn:count()). Since many people use no-namespace schemas, and
they're quite likely to include types with names that clash with system
functions, no-one could come up with a way of handling these other than
retaining the "cast" syntax.
Remember that committees find it much easier to add something to a language
than to take something out.
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--