XSLT Function GetConstant

Returns a constant. The result can be string, number or guid. If the constant is mapped as a Data Constant Menu Item and the user changed its value using the menu, the user value is returned. Otherwise the original value stored in the model is returned.

NAMESPACE

xmlns:AS="http://schema.advantages.cz/AsapFunctions"

SYNTAX

string GetConstant(string name)

PARAMETERS

Name Description
name Name of the constant.

REMARKS

Accessing constants is very efficient, because they are always cached in memory.

EXAMPLE

This example adds 1 working day to a source date. The calendar is stored in a constant DefaultCalendarId.
Source XML

<ROOT> 
    <test date="2012-23-03"/> 
</ROOT>

Stylesheet

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 
    xmlns:AS="http://schema.advantages.cz/AsapFunctions" 
    xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="AS date"> 
    <xsl:template match="/"> 
        <test test="{AS:AddWorkingDays(/ROOT/test/@date, 1, AS:GetConstant('DefaultCalendarId'))}" /> 
    </xsl:template> 
</xsl:stylesheet>