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
RDF data
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

assign

Creates a local variable and assign a value to it.
null assign ( var_name string, var_value any);
Description

This function calculates the first argument, var_name, and converts it to the string, if needed. Then it checks if there is a local variable or parameter with such name. If not found, it checks if there is a global variable or parameter with such name. If nothing found in both cases, a new local variable is created with this name. The the value of found or created variable is changed to the value of the second argument, var_value.

The value of the variable may be accessed like the value of any variable created by <xsl:variable> XSL element or FLWR operator of XQUERY. The same $name should be used to get the value.

In XSLT, common rules for local variables are used for variables created by assign() function.

This function is not a part of XPATH 1.0 or XQUERY 1.0 libraries of standard functions. It may produce strange results if used in XQUERY expressions in order to change the value of local variable created by FLWR expression. It may cause infinite loop if used in XSLT expressions in order to change the value of a variable used in currently executed <xsl:apply-templates> instruction. For both safety and portability, it is much better to use <xsl:variable> and <xsl:param> XSL elements in stylesheets or LET operator in XQUERY expressions. In addition, let() function is not portable, but it may be used in XPATH or XSLT without the risk of undesired effects.

Parameters
var_name – The name of variable which must be found or created.
var_value – The value which should be assigned to the variable.
Return Types

Null

Examples

Increment local variable $counter by 1.

	assign('counter', $counter+1);