Updating counter in XQuery

后端 未结 7 1939
孤街浪徒
孤街浪徒 2020-12-10 13:39

I want to create a counter in xquery. My initial attempt looked like the following:

let $count := 0
for $prod in $         


        
7条回答
  •  情歌与酒
    2020-12-10 14:13

    Specific to MarkLogic you can also use xdmp:set. But this breaks functional language assumptions, so use it conservatively.

    http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/apidoc/ExsltBuiltins.xml&category=Extension&function=xdmp:set

    For an example of xdmp:set in real-world code, the search parser https://github.com/mblakele/xqysp/blob/master/src/xqysp.xqy might be helpful.

提交回复
热议问题