[MarkLogic Dev General] Which is better?
Tim Finney
tjf2n at virginia.edu
Wed Feb 28 14:24:32 PST 2007
I use this idiom quite often:
for $node in $thousands-of-nodes
let $n := $node/path/to/@n
return
if ($n)
then $n
else do-something-else()
But one can say this instead:
for $node in $thousands-of-nodes
return
if ($node/path/to/@n)
then $node/path/to/@n
else do-something-else()
As a general rule, is it better to declare a variable and use it in the
if test and then clause, or to use a path in both places? Maybe there is
a better idiom?
Best
Tim Finney
Programmer
University of Virginia Press
More information about the General
mailing list