Created
June 24, 2012 20:41
-
-
Save netsi1964/2984824 to your computer and use it in GitHub Desktop.
Dynamicweb XSLT Translate method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:variable name="translationfile" select="document(concat('http://',/Template/GlobalTags/Global.Request.Host,'/Files/Templates/Translations.xml'))" /> | |
<xsl:variable name="currentlanguage" select="/Template/GlobalTags/Global.Area.LongLang" /> | |
<xsl:template name="translate"> | |
<xsl:param name="translationkey" /> | |
<xsl:param name="defaulttranslation" /> | |
<xsl:choose> | |
<xsl:when test="$translationfile/translations/key[@name=$translationkey]"><xsl:value-of select="$translationfile/translations/key[@name=$translationkey]/translation[@culture=string($currentlanguage)]" /></xsl:when> | |
<xsl:otherwise><xsl:value-of select="$defaulttranslation" /></xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> | |
<xsl:call-template name="translate"> | |
<xsl:with-param name="translationkey" select="'YourKeyName'" /> | |
<xsl:with-param name="defaulttranslation" select="'Default value'" /> | |
</xsl:call-template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment