Comments (3)
Hi,
Please have a look on the MarkLogic documentation here.
Library Modules Default Function Namespace Defaults to Library Namespace
The default function namespace of an XQuery library module is the namespace of the library module. This allows you to declare functions in the library namespace without prefixing the functions. You can override the default function namespace with a declare default function namespace declaration in the prolog of the library module. For library modules where you do not override the default function namespace (and as a general best-practice), you should prefix the XQuery-standard functions (functions with the fn: prefix, which is bound to the http://www.w3.org/2005/xpath-functions namespace) with the fn: prefix. Note that main modules default function namespace defaults to the fn: namespace, which is different from library modules.
When you select MarkLogic as the Flavour in the settings this is how the system will treat it for module libraries. For all other Flavours and for MarkLogic main modules the system behaves as you've described.
Please let me know if you've observed a different behaviour and provide examples!
from intellij-xquery.
That's interesting. The documentation is certainly clear, but that's not the behavior I see in ML v. 8.0-6.1 (and every previous version I've worked on). For example, a library module that makes several clearly meaningful XPath function calls:
xquery version "1.0-ml";
module namespace tn = "http://test/ML/default-namespace";
declare function tn:dostuff()
{
string-join(
for $i in tokenize('abc;123;jkl', ';')
where true()
return concat($i, '.')
, ' ')
};
When imported into a main module, tn:dostuff()
runs without error. Also interesting, even if you remove the tn
prefix from tn:dostuff
, it follows the behavior described in the documentation, associating it with the module namespace, while still resolving non-prefixed XPath functions to the XPath functions namespace.
But if an XPath function's local name is defined in the module namespace, any non-prefixed call to that function name will give priority to the module namespace over the XPath namespace:
declare function true() (: Any call to true() instead of fn:true() will call this :)
{
'foo'
};
from intellij-xquery.
So the documentation is quite precise but leaves the last bit a bit 'undefined' where the implementation is actually quite strict.
It looks like if there is a local implementation in given module namespace then it goes to it. If there isn't it tries to fall-back to the default function namespace. Thanks for providing the examples and explanation!
from intellij-xquery.
Related Issues (20)
- Known issues and future enhancements for Saxon Debugger
- Highlight function declarations with reserved names that are in default function namespace
- Indentation in Run window using BaseX (native embedded)
- Update plugin to support IntelliJ 17.1 HOT 7
- Support MarkLogic cts:highlight built-in variables
- Parser error reported for computed element constructors in XPath steps
- Unused namespace reported for prefix used in xs:QName constructor
- Support ArgumentPlaceholder("?") in function calls HOT 2
- Support for max line width for code formatter
- Option to remove add spaces inside brackets
- Support for MarkLogic server side XQuery engine and debugger HOT 2
- Parser error for conditional in "Order By"
- Parser error for namespace prefix "default" HOT 1
- Update plugin to support IntelliJ 17.2
- Find usages should not show usages in text files HOT 1
- MarkLogic predeclared namespaces mismatch HOT 6
- Update plugin to support IntelliJ 2018.2
- Update plugin to support IntelliJ 2019.3
- Unable to use intellij with xquery plugin 1.7.2-202 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intellij-xquery.