0

Problem I'm trying to escape & so that I can use js to redirect the user

Code

//first try
location.replace('//<xsl:call-template name="domainLocator"></xsl:call-template><xsl:value-of select="$dotNetAppFolder" />/Display?page=splash_device&xpf=android');
//second try
<xsl:text disable-output-escaping="yes" >/Display?page=splash_device&xpf=android</xsl:text>

Desired Outcome

web/Display?page=splash_device&xpf=android

So, the problem seems simple to me, I just want to escape the & so my page won't throw an error.

NB: Also, I know this question has been asked before, but there was no accepted question and it is 4 years old. Thought somebody must know an answer or if its not possible.

Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291
  • Can you show us what your expected output is? It's confusing that you say you want to escape `&` yet are using `disable-output-escaping` which, as the name suggests, _disables_ escaping. – JLRishe Jul 04 '13 at 11:33
  • Updated to display the desired out coming. As you can guess I've no idea what I'm doing with XSLT, the display-out-escaping from another thread implied this would allow escaping. – Jamie Hutber Jul 04 '13 at 12:19
  • From your desired outcome it sounds like what you want to do is _not_ escape the `&`s, in which case I suggest trying `disable-output-escaping="yes"`, but it would be even better to have the bulk of your JS in a separate JS file and just pass it the needed values via functions. – JLRishe Jul 04 '13 at 12:24
  • Ye, sadly its not an option, having the JS in a separate file. I guess then, why isn't `disable-output-escaping="yes"` working for me? If this is the correct behaviour! – Jamie Hutber Jul 04 '13 at 12:25
  • Not all XSLT processors support `disable-output-escaping`. What processor are you using? – JLRishe Jul 04 '13 at 12:30
  • bugger, no idea what processor is being used. Find it odd that a chip would make a difference. Unless I'm thinking about it wrong and you mean version 1? – Jamie Hutber Jul 04 '13 at 14:18
  • I'm not referring to your CPU. I mean as in MSXSL, Saxon, Xalan, IE, FireFox, etc. – JLRishe Jul 04 '13 at 15:08

2 Answers2

2

This think this is a simple one.

Try using:

&amp; 

instead of:

&

Hope that helps!

rjmacarthy
  • 2,164
  • 1
  • 13
  • 22
0

There is no way to include & within xslt currently. Sadly I had to strip it all out

location.replace('//<xsl:call-template name="domainLocator"><xsl:with-param name="version" select="'desktop'" /></xsl:call-template>');
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291