Andrew Welch wrote:
On 9/17/07, Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> wrote:
Hi David, thanks for your response.
It was from me Abel... :)
oops, sorry! I need new glasses!
It's important to realise what happens when you add as="element()+" to
a variable definition - I've been caught out by it before when typing
all of my variables.
and I now by not typing the variables, or, for that matter, the result
of my functions.... I'll get a red card from MK for that!
<xsl:variable name="root" as="document-node()">
...so in this case I decided that the "as" attribute can be left off
(this is the exception to the rule of "always use the as attribute").
but, when teaching, it is perhaps better to make it explicit. As in a
typed language, you don't want a variable that is meant to be a string
to be treated as type Object, Any or Base (depending on your language)
just because you forgot to add the type. Instead, you teach your pupils
to *always* add a type, even when you explicitly want it to be of type
Object (or document-node() in the above example).
The start of the thread where DC explains it is here:
http://www.oxygenxml.com/archives/xsl-list/200607/msg00880.html
Aha, so there was some 'David' along the line. Thanks for the pointer!
(and the clear explanations).
Cheers,
-- Abel Braaksma
--~------------------------------------------------------------------
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>
--~--