嗨,這可能是一個奇怪的問題,但我想知道如何在 Xbase 中宣告一個函式。
有人告訴我這是如何:
declare function prefix:name($parameter as DataType)
as returnDataType {
..code..
};
我這樣做了:
declare function local:test($i as xs:integer?)
as xs:integer
{
return $i
};
但它一直說我有語法問題
期待表達。
uj5u.com熱心網友回復:
我找到了這個問題的答案,問題是當你在 Xbase 中宣告一個函式時,你必須在宣告之后呼叫它,如下所示:
//declare your function
<test>{local:test("Example")}</test>
否則,它會將其視為語法問題。
uj5u.com熱心網友回復:
你的功能應該是
declare function local:test($i as xs:integer?)
as xs:integer
{
$i
};
在 XQuery 中,return關鍵字僅用于 FLWOR 運算式。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/396660.html
