Previous Next

Evaluates an XPath expression and stores it in (= assigns it to) a named variable. The variable is global: from any later script section, you can refer to its value by writing $variable. If a variable by the same name is already in use, the value it currently holds is silently overwritten.

This directive is the same as pc:assign-var except that it is an XML attribute rather than an XML element.


   assign:variable = "expr" />

The required variable identifies the variable by name and the required expr is the value you provide for the variable. Expr may be submitted either as a literal or as an XPath expression presented as an attribute value template, ie., surrounded by curly braces ( {  } ).



This example executes a script ( ... ) for each of the "computer" elements found.

In each interation, the "name" attribute of "computer" is assigned to a variable called "result". This variable value may be referred to as $result.



In directives dedicated to assigning values to variables, the assign: namespace prefix is NOT used:

     servername="{path:GetFileName(directories:Get())}" >


See also