1

I have javascript code into xslt which should check image dimension. If width is greater than height to rotate img.

<script language="javascript">
    var a = 3;
    var b = 1;
    if (a > b) {
      document.getElementById("img1").style.transform = "rotate(90deg)";
    }  
 </script>  

I tried:

1) &gt;

2) <![CDATA[ --code --]]>

3) disable-output-escaping="yes"

But nothing works. In console see an error message enter image description here

Thanks

0

1 Answer 1

1

Use &gt; in your XSLT but set

<xsl:output method="html"/>

so that it is serialized as >;

See also

Sign up to request clarification or add additional context in comments.

7 Comments

I have already selected one of your links as a dupe. I think you could have done the same
@mplungjan: At the time of your comment preceding your VTC, I'd already posted this answer without the "See also" links. I thought your duplicate link was good, so I added it and another too, all within initial 4 minutes. No disrespect intended.
@kjhughes I saw that link "xslt, javascript and unescaped html entities" before and tried everything but it doesn`t work for me. even output as html.
@BladeRunner: Are you trying to run your XSLT in the browser, or does your XSLT generate HTML on the server (or offline, batch), which is then sent to the browser?
@kjhughes none taken
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.