This project is read-only.

XsltDb Parameters concepts

Parameters are the heart and soul of XsltDb module. Parameters are variables changed when user perform some action. Рarameter change always lead to module or page reload so change of a parameter has not to be specialy determined. Your XSLT just should reflect parameters values regardless the reasons they have changed.

Types of parameters

There are three types of parameters in XsltDb:
  • local module parameters. These parameters are most used ones. if parameter started with latin letter it is treated as local. Value of local parameter can be read only on within XSLT of module, that set parameter value with mdo:submit, mdo:ajax or mdo:navigate.
  • global page parameters. These parameters are used for intercommunications. As far as XsltDb is DotNetNuke module, you are able to put multiple XsltDbs on single page. All page modules can read values of global parameters with mdo:param and write values with mdo:submit, mdo:ajax and mdo:navigate. Parameter is treated as global if it's name is started with '$'. You can setup multiple XsltDb modules and they will work as single object if you will use global parameters.
  • short-life parameters. These parameters are actually commands. They live only one request. Parameter is treated as command if it's name is started with '@'. If you don't assign a value for the parameter with mdo:submit, mdo:ajax or mdo:navigate XsltDb removes this parameter from the parameters collection. So the next request it will be treated as not set.
You can combine "$" and "@" as follows: $@test to make test a global command. @$test is treated as incorrect comand name.
Parameters can be assigned a value only by visitor actions. You are not able to change parameters within XSLT. You can't use parameters as variables as it would conflict with XSLT variables concept. This is also makes many difficulties to provide interchangeable way to use mdo:submi, mdo:ajax and mdo:navigate.


When you use mdo:ajax to set global parameter value, XsltDb tries to determine what other modules use this parameter. And it first refreshes module-source of the parameter change and then it refreshes all other modules that depend on changed parameter. So you always have valid state of all modules even they are used ajax. This is something like simplified DotNetNuke Inter-Module Communication (IMC) for the DotNetNuke Modules written in VB/C#. But it also supports AJAX.

To review how it works you can setup 3 XsltDb modules:

Value of parameter 'test':
<xsl:value-of select="mdo:param('$test')" /><br />
<a href="javascript:{mdo:submit('$test', mdo:param('$test', 0) + 1)}">Increase with page reload</a><br />
<a href="javascript:{mdo:ajax('$test', mdo:param('$test', 0) + 1)}">Increase with ajax</a>
If you want notify your module that something has changed you may use fake global parameter. But if you don't use parameter (i.e. don't call mdo:param to retrieve parameter value) you have to manually subscribe to the parameter change. This is done by including in XSLT the following preprocessor command:


after you have subscribed to the fake parameter you can use javascript function:

To refresh subscribed modules.

Client-side (javascript) parameter value

If parameter value is a string beginning with '@' XsltDb treates it as a javascript expression and inserts into HTML without apostrophes (to be evalueted on visitor input). Try to setup the following XsltDb modules to discover how it works:

<xsl:variable name="val" select="mdo:param('$val')"/>
<select onchange="{mdo:ajax('$val', '@this.value')}" >
  <xsl:for-each select="mdo:sequence(5)" >
    <option value="{.}">
      <xsl:if test=".=$val">
        <xsl:attribute name="selected">selected</xsl:attribute>
Your choice is: {{mdo:param('$val')}}

See also:

Last edited May 12, 2010 at 8:55 PM by findy, version 10


No comments yet.