I have an ASP.NET web app where the back end data (XML format) is transformed using XSLT, producing XHTML which is output into the page.
Simplified code:
XmlDocument xmlDoc = MyRepository.RetrieveXmlData(keyValue);
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(pathToXsl, XsltSettings.TrustedXslt, null);
StringWriter stringWriter = new StringWriter();
xsl.Transform(xmlDoc, null, stringWriter);
myLiteral.Text = stringWriter.ToString();
Currently my XSL file contains the XHTML markup elements, as well as text labels, which are currently in English. for example:
<p>Title:<br />
<xsl:value-of select="title"/>
</p>
<p>Description:<br />
<xsl:value-of select="desc"/>
</p>
I would like the text labels (Title and Description above) to be localized. I was thinking of using .NET resource files (.resx), but I don't know how the resx string resources would get pulled in to the XSLT when the transformation takes place.
I would prefer not to have locale-specific copies of the XSLT file, since that means a lot of duplicate transformation logic.
(NOTE: the XML data is already localized, so I don't need to change that)