Subject: Re: [xsl] when to use 'as' attribute on a variable|
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Tue, 28 Feb 2006 07:16:27 +1100
> 1. when you should and should not be using an as attribute on xsl:variable > in XSLT 2 The right question is: Q: "when not to specify the type of an xsl:variable" A. Always do specify the type. Exceptions are extremely rare. Even for such generic functions in FXSL as foldl(), the parameters have specified type: <xsl:function name="f:foldl"> <xsl:param name="pFunc" as="element()"/> <xsl:param name="pA0" as="item()*"/> <xsl:param name="pList" as="item()*"/> <xsl:sequence select= "if (empty($pList)) then $pA0 else f:foldl($pFunc, f:apply($pFunc, $pA0, $pList), $pList[position() > 1] )"/> </xsl:function> This not only makes the code much more understandable, but in many situations allows the compiler to catch and report errors, that otherwise would have gone unnoticed. One of the rare functions in FXSL, which has the type of its parameter unspecified is f:type() because it must determine and return the type of the argument. Cheers, Dimitre Novatchev On 2/28/06, tom tom <tomxsllist@xxxxxxxxxxx> wrote: > Can anyone point me to some reliable documentation on: > > 1. when you should and should not be using an as attribute on xsl:variable > in XSLT 2 > > 2. Which numerical datatype to use in which situation when declaring > variables holding numerical data. > > Thanks in advance. > > Tom > > _________________________________________________________________ > Be the first to hear what's new at MSN - sign up to our free newsletters! > http://www.msn.co.uk/newsletters > > -- Cheers, Dimitre Novatchev --------------------------------------- The significant problems we have cannot be solved at the same level of thinking with which we created them.