Can fn:string-join help?  Join with ',', and glue on whatever you like
before or after?

On Mon, Nov 16, 2015 at 11:30 PM, Kari Cowan <[email protected]> wrote:

> Is there any built-in component I can reference that would indicate in the
> loop below where $counter is less than the last item in the loop?
>
>
>
> This would print the json for the return only when $counter=1, is simple
> way to know when $counter < LastItem?
>
>
>
> let $outputJSON:=("{&#34;events&#34;:[",
>
> let $config := json:config("full"),
>
>                 $cx := map:put( $config, "whitespace", "ignore" )
>
> for $events at $counter in $search-this-partner/event
>
> order by $events/EventStartDate/@date ascending
>
>   return if($search-this-partner/event[$counter=1]) then
>
>     fn:concat(json:transform-to-json( fn:doc($events/doc-uri), $config ),
> ",")
>
> else
>
>     "foo",
>
> "]}")
>
>
>
> >>
>
> {"events":[
>
> foo
>
> Event object
>
> foo
>
> ]}
>
> ------------------------------
> Learn more about ALM, visit http://www.alm.com . – ALM, an Integrated
> Media Company, is a leading provider of news and information for the legal
> and commercial real estate markets. ALM’s market-leading brands include The
> American Lawyer, Corporate Counsel, GlobeSt.com, Insight Conferences,
> Law.com, Law Journal Press, LegalTech, The National Law Journal and Real
> Estate Forum.
>
>
> _______________________________________________
> General mailing list
> [email protected]
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to