Mozilla Skin
Translate this page


Set Node

From Moving Pictures

The set node is one way to define a new variable, and how you define values for variables. There are a few ways to use this node depending on what you are trying to do. Please see the following for a list of node attributes.

Node Attributes

Attribute Description
name This attribute defines the name of the variable that you are making/setting. This is a required attribute.
value This attribute defines the value of the variable that you are making/setting. Depending on how you are using the set node, this may not be a required field. This will be explained.

Examples

If you are using the set node with the value attribute, it will look something like the following:

<set name="varName" value="varValue" /> 

If you are using the set node without the value attribute, it will look something like the following:

<set name="rx_search_results">
      <![CDATA[
      ><a href="/title/(tt\d{7})/"[^>]+>(?!")([^<]+)</a> \((\d{4})[\/IVX]*\)(?! \(VG\))(<br>.*?aka\s(<em>.+?</em>).*?</td>)?
      ]]>
</set>

In the last example the set node uses its inner text as the value in stead of the value attribute's text. Either usage is valid. The second example makes it a lot easier to deal with regular expressions which in most cases will have special characters in it.

Reminder

It is important to note that a variable's value is called by encasing the variable in ${}.