Actually i want to do like this as you mention in your answer but i am loadind XML values in javascript and this script is in XSL.
If i write above code in javascript file then i can not load xml values because these values dynamically loaded at the time of HTML generation.