{comment {"Made by noise.xq, will get OVERWRITTEN"}} gives me $ basex noise.xq <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <!--Made by noise.xq, will get OVERWRITTEN--> <Document>... Is there any function to enable me not to need to hardwire the name into the file?
..not quite sure what you're trying to achieve: Do you want to request the name of your query file from within XQuery? Currently, there's no way to do this, but we could think about adding a pre-defined XQuery function for that. ___________________________
On Sat, Dec 24, 2011 at 3:24 PM, jidanni@jidanni.org wrote:
{comment {"Made by noise.xq, will get OVERWRITTEN"}} gives me $ basex noise.xq
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"> <!--Made by noise.xq, will get OVERWRITTEN--> <Document>... Is there any function to enable me not to need to hardwire the name into the file? _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
"CG" == Christian Grün christian.gruen@gmail.com writes:
CG> ..not quite sure what you're trying to achieve: Do you want to request CG> the name of your query file from within XQuery?
Yes, like I can do in bash $ cat f echo $0 $ bash f f
CG> Currently, there's no way to do this, but we could think about CG> adding a pre-defined XQuery function for that.
Yes, like one can do with $ man perlvar $PROGRAM_NAME, $0 Contains the name of the program being executed. $ARGV Contains the name of the current file when reading from "<>".
Wait, $ basex i.xq Stopped at line 1, column 7 in /tmp/i.xq: [XPDY0002] No context item set for 'zzzzzzz'.
Something inside basex knows that it is processing /tmp/i.xq . Can we get access to that something from within the xquery program, and would that be an basex specific way or general xquery way?
I can't find any fn:error() examples that can be smart enough to tell the user what file he is processing without hardwiring the file name into the program.
Well I guess one way not to hardwire it into the program is to pass it in as an external variable... rather clumsy with the same item twice on the command line.
Well I guess one way not to hardwire it into the program is to pass it in as an external variable... rather clumsy with the same item twice on the command line.
Sorry for the delay. The discussed function has now been added:
http://docs.basex.org/wiki/Utility_Module#util:path
Hth, Christian
basex-talk@mailman.uni-konstanz.de