# 22. Virtuoso Functions Guide - current

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
and
append
assign
avg
boolean
ceiling
concat
contains
count
create-attribute
create-comment
create-element
create-pi
current
distinct
doc
document
document-literal
empty
ends-with
every
except
false
filter
floor
fn:collection
for
format-number
function-available
generate-id
id
if
intersect
is_after()
is_before()
key
lang
last
let
list()
local-name
max
min
name
namespace-uri
normalize-space
not
number
or
position
processxquery
processxslt
processxsql
progn()
replace()
round
serialize
shallow
some
starts-with
string
string-length
substring
substring-after
substring-before
sum
system-property
text_contains()
translate
true
tuple()
union
unordered
unparsed-entity-uri
urlify
xmlview
Functions Index

## current

Returns a node-set that has the current node as its only member.
node-set current
Description

The function returns a node-set that has the current node as its only member. For an outermost expression (an expression not occurring within another expression), the current node is always the same as the context node. For an expression occuring within another expression, e.g. within predicate in some path, the current node is the same as the context node of the first step in the path.

Please refer XSL standard before the first use of this function, to understand exact difference between "current" and "context" node.

XSLT 1.0 states that it is an error to use the current() function in a XSL "pattern", e.g. in "match" attribute of <xsl:key> element, because patterns have no value assigned for current node assigned processing. Instead of reporting the error, Virtuoso's XSLT processor uses context node if current node is not set.

Return Types

Node-set that has exactly one member.

Examples
Function current() in top-level expression.

These two elements produce the same result:

    <xsl:value-of select="current()"/>
    <xsl:value-of select="."/>

Function current() inside the path.

For current node, which is equal to context node of whole <xsl:apply-templates> key, try to find such item of glossary in the document, that the name of item is equal to "ref" attribute of current node.

    <xsl:apply-templates select="//glossary/item[@name=current()/@ref]"/>