Setting Dynamic Properties

Top  Previous  Next

You can set the properties of elements dynamic by using XSL Functions.

Examples

Setting the value of an Editbox

 

Editbox Element

  Value         : $vof(Price)

 

The value of the Editbox will be the value stored in currently focused XML node "Price".

 

Setting Panel Backgroud color dynamically

 

Panel Element

  Background

    Color       : $vof(position() mod 2 = 0 ? 'gray' ; 'silver')

  Repeat

    For Each    : /products/item    

 

The panel will be repeated for each "/products/item" node and the background color of a repeated panel will be "gray" if sequence number is an even number, otherwise it will be "silver".

Setting Font Color of a Text dynamically

 

Text Element

  Font

    Color       : $vof(Stock < 1 ? 'red' ; 'black')

 

The font color will be "red" if the value of "Stock" node is lower than "1" otherwise "black".

Setting boolean properties dynamically

 

Checkbox Element

  Checked       : $vof(InCampaign = 'true')

 

The Checkbox will be initially checked if the value of "InCampaign" node is "true".

Setting Source of an Image Dynamically

 

Image Element 

  Source        : /images/$vof(ImageName)

 

The real name of the Image file will be complete with the value of "ImageName" node.

 

<root>
  <products>
    <item>
      <code>P01712</code>
      <desc>Desktop Computer</desc>
      <imageName>images/desktop.gif</imageName>
    </item>
  </products>
</root>

 

Defining a dynamic link

 

Text Element 

  Hyperlink

    Value    : display.doms?$vof(usertype = 'admin' ? 'pg=AdminPage' ; 'pg=NormalPage')

 

If the value of usertype node is 'admin' the definition will be equivalent to

 display.doms?pg=AdminPage otherwise to

 display.doms?pg=NormalPage