xsl transform: problem with Ampersand URL parameters
- by Rac123
I'm having issues with transforming XSL with parameters in a URL. I'm at a point that I can't change the C# code anymore, only can make changes to xsl file.
C# code:
string xml = "<APPLDATA><APPID>1052391</APPID></APPLDATA>";
XmlDocument oXml = new XmlDocument();
oXml.LoadXml(xml);
XslTransform oXslTransform = new XslTransform();
oXslTransform.Load(@"C:\Projects\Win\ConsoleApps\XslTransformTest\S15033.xsl");
StringWriter oOutput = new StringWriter();
oXslTransform.Transform(oXml, null, oOutput)
XSL Code:
<body>
<xsl:variable name="app">
<xsl:value-of select="normalize-space(APPLDATA/APPID)" />
</xsl:variable>
<div id="homeImage" >
<xsl:attribute name="style">
background-image:url("https://server/image.gif?a=10&Id='<xsl:value-of disable-output-escaping="yes" select="$app" />'")
</xsl:attribute>
</div>
</body>
</html>
URL transformed:
https://server/image.gif?a=10&Id='1052391'
URL Expected:
https://server/image.gif?a=10&Id='1052391'
How do I fix this? The output (oOutput.ToString()) is being used in an email template so it's taking the URL transformed literally. When you click on this request (with the correct server name of course), the 403 (Access forbidden) error is being thrown.