[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xslt 3.0, and use of 'as' attribute with xsl:varia
> I think, the XSLT 3.0 variable declaration, <xsl:variable name="var1" select="'4'" as="xs:integer"/> should work similarly (I think, it should succeed, and the specific XPath 3.1 function conversion rule seems to me is wrong if it, disallows this. Apologies to be saying like this, and disagreeing to the XPath 3.1 spec wrt this point) to what "cast as" expressions as cited above are able to do. > > Any thoughts please? > With implicit conversion there is a balance between the early error detection that you get from strict rules, versus the convenience you get from lax rules. For 4.0 we have relaxed the rules a little, for example <xsl:variable select="2" as="xs:positiveInteger"/> will now work. Note that in XQuery (prior to 4.0), you don't even get atomization in a variable binding, for example let $x as xs:string := <a>help</a> will give you a type error. To understand these decisions you need a historical and sociological perspective as well as a purely technical one. XPath 1.0 was completely dynamically typed, in the tradition of Javascript, while XQuery 1.0 was designed by people from the database query languages tradition where optimization is a key driver, and optimization often relies on having accurate knowledge of static types. So there were some real clashes, and as a result you get some messy design compromises. Michael Kay Saxonica
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|