Hello Ron,

not Christian, but I try anyway to help you :)

If you say yout want a "generate consecutive numbers in a for loop" are you aware of the "at" construct for flwor expression, e.g.

    for $x at $pos in 10 to 19 return $pos

will return the numbers 1 to 10, i.e. is a consecutive counter.

Cheers
Dirk


On 10/20/2015 03:23 PM, Ron Katriel wrote:
Hi Christian,

Is there a way to generate consecutive numbers in a for loop in BaseX? I am iterating over a collection of XML files from clinicaltrials.gov and need to tag each output record with a unique ID starting at 1. I have seen many discussions of this (some involving incrementing a counter in a dummy node) but have not found a clean solution that actually works. For example, I tried to adapt the code snippet you provided in https://mailman.uni-konstanz.de/pipermail/basex-talk/2010-May/000259.html to create a function that accomplishes this without referencing an auxiliary file (see below) but cannot get past the perplexing syntax error ([XQST0049] Duplicate declaration of static variable $root.).

Thanks,
Ron


declare variable $root := <root count="0"/>;

declare function local:getuid () as xs:integer {
  let $count := $root/@count
  return (
    insert node <node id='{ $count }'/> into $root,
    replace value of node $count with $count + 1
  )
};

On October 19, 2015 at 5:12:19 PM, meumapple (meumapple@gmail.com) wrote:

Hi Christian,

I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).

Whitespaces cannot be shown, only new line character (this happens also on a windows machine).

Joseph

ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?



Il giorno 19/ott/2015, alle ore 14:02, Christian Grün <christian.gruen@gmail.com> ha scritto:

Hi Joseph,

> I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?

You can disable "Automatically add characters" in the Preferences
dialog. Could you please detail which autocompletions are particularly
confusing for you?

> I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)

Tabs and non-breaking spaces are visualized when activating "Show
invisible characters" in that same dialog.

-- 
Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22