[xquery-talk] using a context node in a for loop

Torsten Grust grust at in.tum.de
Wed Oct 18 11:02:02 PDT 2006


Hi all,

On Oct 17, 2006, 5:05 PM, David Carlisle wrote with possible deletions:
>
>> Should the function below work?
> no:-)
>
> a function does not automatically pass the current context,
> . is undefined in a function body, so you can't use relative paths  
> like
> '@id and @db-ref

I don't buy this explanation, David.  Sure, no context node is  
defined in user-defined functions per se.  But Robert explicitly  
establishes a context node in the function:

   doc(...)/*/
        (
          ...
        )

This means that the attribute axis steps like @id, @label should work  
fine in the parentheses.

The error message that Robert receives seems weird to me (shouldn't  
happen).

Cheers,
    --Torsten
--
   | Prof. Dr. Torsten Grust                         grust at in.tum.de |
   |                                 http://www-db.in.tum.de/~grust/ |
   |     Database Systems - Technische Universität München (Germany) |






More information about the talk mailing list