Search code examples
xmlxsltescapinginvalid-characters

XSLT: Can't output `& ` even whilst trying to espace


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.


Solution

  • This think this is a simple one.

    Try using:

    &amp; 
    

    instead of:

    &
    

    Hope that helps!