I'm using an XSL file to do the rendering of an ASP.NET webpart that I made, but now I want to localize the strings inside that XSL file:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:siteInfo="urn:siteInfo" version="1.0">
<xsl:output method="html" omit-xml-declaration="no"/>
<xsl:template match="*|/">
<p>
Project name: <xsl:value-of select="siteInfo:GetProjectName()"/>
</p>
In the above example I want to localize "Project name". The language in which I'm working is C# and this is the snippet I use for transforming:
XslCompiledTransform transformationEngine = new XslCompiledTransform();
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = CredentialCache.DefaultNetworkCredentials;
transformationEngine.Load(XslUrl, new XsltSettings(true, true), resolver);
XsltArgumentList args = new XsltArgumentList();
args.AddExtensionObject("urn:siteInfo", siteInfo);
transformationEngine.Transform(xmlDocument, args, ms);
Is it possible to do localization through resource (resx) files in that XSL file? In the rest of my project I'm using the following line to insert localized strings:
HttpContext.GetGlobalResourceObject(resourceName, resourceKey).ToString();
Kind regards,
Jeroen