W3C home > Mailing lists > Public > public-qt-comments@w3.org > November 2004

RE: [XQuery] context for execution of imported functions

From: Michael Kay <mhk@mhk.me.uk>
Date: Wed, 10 Nov 2004 21:26:29 -0000
To: 'Botond Birˇ' <botond.biro@altova.com>, <public-qt-comments@w3.org>
Message-ID: <E1CRzzc-0001Q6-Lw@frink.w3.org>

> I would have a question related to imported functions & variables: 
> are they executed using the static context of the imported 
> module or with the context of the importing module ?

Each module has its own static context. The static context for a function is
determined by the module it appears in.
> 
> [XQ-20041029]4.11. "....Each module has its own static 
> context. A module import imports only functions and variable 
> declarations; it does not import other objects from the 
> imported modules, such as in-scope schema definitions or 
> statically known namespaces. Module imports are not 
> transitive-that is, importing a module provides access only 
> to function and variable declarations contained directly in 
> the imported module....." 
> 
> This makes clear that there is no access to indirectly 
> imported functions, vars & type declarations. What about 
> using them in a function body, or variable initializing expression?

If A imports B and B imports C, then things that are statically within A can
reference things in B but not things in C. The things in B that A imports
can of course contain references to C.
> 
> Example: 
> In order to use function a:A() in the main module is it 
> enough to import the library "a"? or the library "b" has to 
> be imported as well in the main module?

The main module doesn't reference anything in B so it doesn't need to import
it.

Michael Kay

> 
> 
> (:  library module a  :)
> module namespace a="a";
> import module b="b";
> declare function a:A()
> {
>     'evaluated A()',
>     b:B()
> }
> 
> (:==================:)
> (:  library module b :)
> module namespace b="b";
> declare function b:B()
> {
>    'evaluated B()'
> }
> (:==================:)
> 
> 
> (:===main module====:)
> import module a="a";
> a:A();
> 
> Similar question for imported variables.
> 
> 
> Best regards
> Botond
> 
> 
> ... Botond Birˇ
> ... Software Engineer
> ... Altova GmbH
> 
> ===================================================================
> Altova« accelerates development and integration projects with soft-
> ware, services and solutions that enhance productivity and maximize
> results. Uncover why Altova is the smart choice of over 1.5 million
> applications developers worldwide!  Look into www.altova.com today!
> XMLSpy« 2005 - MapForce(tm) 2005 - StyleVision« 2005 - Authentic« 2005
> NEW: Advanced standards compliance, XSLT 2.0, XPath 2.0, XQuery 1.0
> SchemaAgent, Eclipse integration, Visual function builder, Word/RTF
> output, database-enabled electronic forms,  XML<->flat-file mapping
> ===================================================================
> 
> The information transmitted in this message and/or as an attachment
> to it  is intended  only for the  person or  entity to  which it is
> addressed and may contain confidential  and/or privileged material.
> Any  review,  retransmission,  dissemination  or  other use of,  or
> taking of any action in reliance upon,  this information by persons
> or entities other than the intended recipient is prohibited. If you
> received this in error,  please contact  the sender  and delete the
> material from any computer.  Altova GmbH  and  Altova, Inc.  do not
> accept legal responsibility  for the contents of this message.  Any
> views or opinions  presented are solely  those of the author and do
> not  necessarily  represent those of  Altova GmbH and  Altova, Inc.
> unless otherwise specifically stated. Thank you!
> 
> 
> 
> 
> 
Received on Wednesday, 10 November 2004 21:27:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:37 GMT