Search code examples
asp.netxmlapache-fop

XSLT passing url to asp page that does not de-escape & to &, what to do?


I have a problem, I have a URL provided from a website in the form:

http://data.dezrez.com/PictureResizer.ASP?PropertyID=99999999&PhotoID=1&AgentID=9999&BranchID=9999&width=750&rotation=0

i am then using in an XSL-FO file which is using the return code

<fo:external-graphic movie="auto" clip="auto" content-height="141mm" 
content-width="188mm" content-y="0mm" content-x="0mm" 
src="http://data.dezrez.com/PictureResizer.ASP?PropertyID=99999999&amp;PhotoID=1&amp;AgentID=9999&amp;BranchID=9999&amp;width=750&amp;rotation=0" 
width="188mm" height="113mm" scaling-method="resample-any-method"/>

however the ASP page at dezrez is not recognising the url as it cannot understand the &amp; and escape it to &, I have not access to their ASP page and need to know how to approach it so that it will work.


Solution

  • There doesnt seem to be an XSL way to do this, so I had to write a simple servlet which de-escapes the url, calls the url, saves the returned image as a temp file and returns the aved file url to the calling process as an xml snippet

    <xsl:variable name="mainpicurl"><xsl:text>http://www.xxxxxxx.co.uk/ImageProcessor/test?url=</xsl:text><xsl:value-of select="descendant-or-self::*[@id='large']/@src"/></xsl:variable>
                        <xsl:variable name="mainpic" select="document($mainpicurl)"/><fo:block>
                        <xsl:variable name="mainpic" select="document($mainpicurl)"/><fo:block>
                        <xsl:call-template name="crop-scale-image">
                            <xsl:with-param name="content-width">188</xsl:with-param>
                            <xsl:with-param name="content-height">113</xsl:with-param>
                            <xsl:with-param name="imgurl"><xsl:value-of select="$mainpic"/></xsl:with-param>
                        </xsl:call-template>