[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Trying to understand root-less or document-node-le

Subject: Re: Trying to understand root-less or document-node-less nodes
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 17 Sep 2007 20:43:03 +0200
Re:  Trying to understand root-less or document-node-le
Andrew Welch wrote:
On 9/17/07, Abel Braaksma <abel.online@xxxxxxxxx> 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.