Mashups in EMML : Writing Mashups in EMML : Transforming Intermediate Results : <assign>
<assign>
 
<assign> Examples
Use <assign> to assign values to a variable. Values may be:
*Literal values
*Fragments of another variable
*A whole variable
You use XPath expressions to define the fragments or variables to assign or otherwise modify the resulting variable content.
Consider these general rules when using <assign>:
*You cannot use <assign> to change the content of a variable that contains a Presto attribute. Variables for Presto attributes are read-only. For more information on Presto attributes, see Using Presto Attributes in Mashups.
*When working with complex variables that have namespaces, you must include either the exact namespace or *: as a namespace wildcard at each step in XPath expressions.
*You can use <assign> to cast strings of well-formed XML to a document-type variable or vice versa. See Copy All of a Variable for an example.
For examples, see Assign Literal Values, Copy Fragments of a Variable, Copy All of a Variable and Replace Existing Values. See also Working Samples for a list of sample mashups you can review.
Can Contain
Empty
Allowed In
mashup | catch | else | elseif | for | foreach | if | macro | operation | sequence | try | while
Attributes
Name
Required
Description
fromvariable
The variable to copy. <assign> must have either a fromvariable, a fromexpr or a literal attribute.
fromexpr
An expression identifying a variable or variable fragment and any functions to apply before copying the result. <assign> must have either a fromvariable, a fromexpr or a literal attribute.
literal
A literal value to assign. <assign> must have either a fromvariable, a fromexpr or a literal attribute.
toexpr
An XPath expression defining a specific node in a variable that is the target to be assigned. <assign> must have either a toexpr or an outputvariable attribute.
mode
An optional flag to indicate whether the assignment should replace the output node or variable. The most common use is to apply an XPath function and assign the result back to the input node or variable.
outputvariable
The variable that is the target to be assigned. <assign> must have either a toexpr or an outputvariable attribute.
Copyright © 2013-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback