Thanks Mike, I had missed that first bit :

declare function local:test()
  as xs:string+
{
   "a", "b", "c"
};


I always write

declare function local:test()
  as xs:string+
{
   ( "a", "b", "c" )
};


But now I can save 2 bytes !
( well , more importantly, save some distraction on my eyes)



-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Michael Blakeley
Sent: Monday, July 20, 2009 2:11 PM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Problem with multiple document inserts

Parens aren't necessary inside a function unless they're required by 
surrounding syntax. For example, some developers feel the need to write 
'return' in all their functions, so they always put FLWOR expressions in 
their functions. But it isn't necessary.

This function decl works without a problem:

declare function local:test()
  as xs:string+
{
   "a", "b", "c"
};

http://www.w3.org/TR/xquery/#doc-xquery-FunctionDecl

        FunctionDecl       ::=          "declare" "function" QName "(" 
ParamList? ")" 
("as" SequenceType)? (EnclosedExpr | "external")

http://www.w3.org/TR/xquery/#doc-xquery-EnclosedExpr

        EnclosedExpr       ::=          "{" Expr "}"

-- Mike

On 2009-07-20 11:00, Lee, David wrote:
> depends where it is ... inside a function you need it , or as part of an
> expression like if or return .
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Jason
> Hunter
> Sent: Monday, July 20, 2009 1:59 PM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Problem with multiple document
> inserts
>
> Yes, although you technically don't need the outer parentheses.  The
> comma alone will be enough.
>
> -jh-
>
> On Jul 20, 2009, at 10:54 AM, Lee, David wrote:
>
>> try
>> (xdmp:document-insert($uri1, $content1),
>> xdmp:document-insert($uri2, $content2))
>>
>>
>>
>> From: [email protected]
> [mailto:[email protected]
>> ] On Behalf Of Richard Strauch
>> Sent: Monday, July 20, 2009 1:53 PM
>> To: [email protected]
>> Subject: [MarkLogic Dev General] Problem with multiple document
>> inserts
>>
>> Hi,
>> I'm having a problem inserting multiple documents from XQuery.  My
>> code is like this
>>
>> (: code to build $content1 and $content2 :)
>> xdmp:document-insert($uri1, $content1)
>> xdmp:document-insert($uri2, $content2)
>>
>>
>> either of these inserts works on its own, but when together I get
>> the error
>>
>> XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error,
>> unexpected QName_, expecting $end
>> in /insertdocs.xqy, on line 55 [0.9-ml]
>>
>> Line 55 is the second document-insert.
>> Clearly I'm not grasping how document-insert works, is there a way
>> to do this?
>>
>> Thanks
>> Richard.
>>
>>
>>
>> <ATT00001.txt>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to