Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can I write Javascript code in XSLT?

Basically I will be calling Javascript's document.location.href to check which site is currently opened (English or Arabic). So let's say if English site is opened, I want to perform some operation in XSLT and if Arabic then I want to perform some different operation.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

As I understand it, XSL is server-side and JS is client-side so you are trying to mix two incompatible layers. What you can do is include a reference to a JS script within your XSL which will then run against the rendered output.

In the example you mention, you could potentially render both language versions using your XSL and then hide whichever you prefer using your JS?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.