Returns a string from a string model. The text will be returned in the user’s language.
NAMESPACE
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
SYNTAX
string GetString(string name)
string GetString(string name, arg0 ... arg9)
PARAMETERS
Name | Description |
---|---|
name | Name of the string. |
arg0 | An (optional) argument to be formatted into the string, replacing {0}. |
arg1 | An (optional) argument to be formatted into the string, replacing {1}. |
… arg9 | There can be up to 10 arguments passed to this function. |
REMARKS
This function is part of the localization infrastructure.
EXAMPLE
This example produces a localized error message to the user.
The string is defined as: The number cannot be higher than 100. Number passed: {0}
Source XML
<ROOT>
<test percentage="120"/>
</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:include href="model://e1c65fcd-118d-4eb3-9c2f-aa27fec132ba"/>
<xsl:template match="ROOT">
<RuleExceptionDataCollection
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:apply-templates select="test"/>
</RuleExceptionDataCollection>
</xsl:template>
<xsl:template match="test">
<xsl:if test="@number > 100">
<xsl:call-template name="Exception">
<xsl:with-param name="FieldName">number</xsl:with-param>
<xsl:with-param name="EntityName">test</xsl:with-param>
<xsl:with-param name="Message">
<xsl:value-of select="
AS:GetString('NumberExceededError', @percentage)"/>
</xsl:with-param>
<xsl:with-param name="Severity">High</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>