ilinsky / jquery-xpath

jQuery XPath plugin (with full XPath 2.0 language support)
180 stars 64 forks source link

Type Cast functions should have '?' cardinality. #14

Closed Parakleta closed 9 years ago

Parakleta commented 9 years ago

Using Michael Kay's book "XSLT 2.0 and XPath 2.0 4th Ed" as a reference on page 655 he says that the type constructor function is identical to the cast as with the ? option. A quote from his book says:

For example, the expression «@A cast as xs:integer?» can be rewritten as a function call, «xs:integer(@A)» ... if an empty sequence is supplied to a constructor function, it returns an empty sequence ... The only cases where you need to use the full «cast as» expression are: When you want to indicate that an empty sequence is not allowed.