tags:

views:

43

answers:

1

I want use localized strings from resources in xsl template as in aspx page, like this: <%=GetLocalizedString("grid_numberof_claim")%>. I am trying use

<xsl:text disable-output-escaping="yes">
    <![CDATA[<%=GetLocalizedString("grid_numberof_claim")%>]]>
</xsl:text>

but it is not useful.

Actually i can pass localized strings inside XML node, for example "localization". But i am looking for way to get its value in aspx style.

+2  A: 

Using ASPX style isn't possible.

You can use XsltArgumentList to send parameters to your XSLT template, as explained here: HOW TO: Execute Parameterized XSL Transformations in .NET Applications

EDIT: Yes, you can pass arguments client-side too.

xmldoc = ... // your xml document

var xslt = new ActiveXObject("Msxml2.XSLTemplate.4.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");

xslDoc.async = false;
xslDoc.load("YourTemplate.xsl");
xslt.stylesheet = xslDoc;

xslProc = xslt.createProcessor();
xslProc.input = xmldoc;
xslProc.addParameter("param1", 123);
xslProc.addParameter("param2", "abc");
xslProc.transform();

But client-side leads to another solution: You can rename your XSLT file to ASPX and to use <%= %> syntax

Rubens Farias
Hm... not un my case. I am making xslt transformation from client side, so i can not pass XsltArgumentList.
Vokinneberg
Wery well. Thanks for answer :)
Vokinneberg