i have the lang_lib.xslt which returns $flang for the localization in my code....i want to pass this $flang as a .net control parameter too so that i can alo localize my .net content based on the query...The thing is $flang is a variable in xslt and how will i get that variable to put it as a parameter in a .net control./...it is also impossible to compile a .net macro inside xslt...so please help me!!
To my knowledge you cannot compile a .Net macro inside Xslt, that just won't work. You could though render another page template which has a .Net control on it, that should work.
Hi raghavendran, we do this just putting it into the Session, and a cookie for later - I think this is part of the standard lang.xslt file you are talking about:
That pushes the value of $lang which is set somewhere in the file ;) Then in our language abstraction class we have the following function:
private static int langid() { if (_languageCodes == null) { Language[] languages = Language.getAll; Dictionary<string, int> languageCodes = new Dictionary<string, int>(); foreach (Language language in languages) { languageCodes.Add(language.CultureAlias.Substring(0, 2), language.id); } _languageCodes = languageCodes; } // Getting the language from the session will fail if this method is called from within a thread, so we need to use a try catch to supress that string lang = ""; try { lang = umbraco.library.Session("lang"); } catch {} if (lang != "") { if (_languageCodes.ContainsKey(lang)) return _languageCodes[lang]; } if (_dafaultLanguageId == -1) { string code = System.Configuration.ConfigurationManager.AppSettings["DefaultLanguageId"]; if (code == null) { throw new System.Configuration.ConfigurationErrorsException("DefaultLanguageId app setting is missing"); } if (!int.TryParse(code, out _dafaultLanguageId)) { throw new System.Configuration.ConfigurationErrorsException("DefaultLanguageId app setting is not a number"); } } return _dafaultLanguageId; }
Which pulls out a lnaguage id from Umbraco (I think), which we use for getting the language name, and then pulling things out of the dictionary with that!
pass xslt o/p to .net user control
i have the lang_lib.xslt which returns $flang for the localization in my code....i want to pass this $flang as a .net control parameter too so that i can alo localize my .net content based on the query...The thing is $flang is a variable in xslt and how will i get that variable to put it as a parameter in a .net control./...it is also impossible to compile a .net macro inside xslt...so please help me!!
Hi raghavendran,
have a look at this: http://umbraco.org/documentation/books/macro-parameters-syntax/advanced-parameter-syntax.
So in order to pass in a language identifier that is e.g. held in the cookie you could do something like this:
To my knowledge you cannot compile a .Net macro inside Xslt, that just won't work. You could though render another page template which has a .Net control on it, that should work.
Sascha
Hi raghavendran, we do this just putting it into the Session, and a cookie for later - I think this is part of the standard lang.xslt file you are talking about:
That pushes the value of $lang which is set somewhere in the file ;) Then in our language abstraction class we have the following function:
Which pulls out a lnaguage id from Umbraco (I think), which we use for getting the language name, and then pulling things out of the dictionary with that!
/Josh
is working on a reply...