How to use XQuery context function in XML

This article deals with XQuery context function
  • 2488

Context Function

The built-in context functions are defined below-

  • last Function

    fn:last function returns the context size from the dynamic context.

Syntax of last function

fn:last() as xs:integer

 

Example of fn:last function
 

The expression (1 to 25) then [fn:last() -1] returns 24.

  • position Function

    fn:position function returns the context position from the dynamic context.

Syntax of position function
 

fn:position() as xs:integer


Example of fn:position function
 

The expression (10 to 20) then [fn:position() eq 6] returns 15.

  • current-date Function

    The fn:current-date function returns the current date with time zone.

Syntax of current-date function
 

fn:current-date() as xs:date


Example of current-date function
 

fn:current-date() returns current date with time zone like 2012-07-13 6:57

  • current-time Function

    The fn:current-time function returns the current time with time zone.

Syntax of current-time function
 

fn:current-time() as xs:time


Example of current-time function
 

fn:current-time() returns current time with time zone like 7:04:07 UTC _5:30

Further Readings

You may also want to read these related articles:

Ask Your Question 

Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.