This might seem like a wierd question, but I have a situation where I'd like to do some form of redirect from an XSLT-script. Is this possible? If it was ordinary ASP.NET I'd do a redirect but this is XSLT. Can it be done using helper functions written in C#?
A solution along the lines that were suggested in the link Doug posted was exactly what I was looking for!
Just in case anyone is curious, I wanted to implement an easter egg in XSLTSearch so if the user enters a specific search phraze, he/she is redirected to a completelly different page.
Response Redirect from XSLT?
Hi!
This might seem like a wierd question, but I have a situation where I'd like to do some form of redirect from an XSLT-script. Is this possible? If it was ordinary ASP.NET I'd do a redirect but this is XSLT. Can it be done using helper functions written in C#?
Thanks in advance!
/Thomas
If you really want to do this, I'd recommend you write an XSLT extension and do the redirect in there. Sounds like an odd situation though.. ;-)
Found this on the old forum - http://forum.umbraco.org/yaf_postst6434_how-to-redirect-in-xslt-macro.aspx
Here is the code that SoerenS used:
<xsl:template match="/">
<script language="javascript">
document.location.href="<xsl:value-of select="umbraco.library:NiceUrl($currentPage/@parentID)"/>#comments";
</script>
Please follow <a href="{umbraco.library:NiceUrl($currentPage/@parentID)}#comments">this link</a>.
</xsl:template>
You must first add namespace (System.Web ?) to xslt, and then call response.redirect.
Sample, which should help http://our.umbraco.org/wiki/reference/xslt/extend-your-xslt-with-custom-functions
And for the definitive answers... check out your options here: http://our.umbraco.org/forum/using/ui-questions/5255-301-redirect-options
cheers,
doug.
Thanks guys!
A solution along the lines that were suggested in the link Doug posted was exactly what I was looking for!
Just in case anyone is curious, I wanted to implement an easter egg in XSLTSearch so if the user enters a specific search phraze, he/she is redirected to a completelly different page.
/Thomas
is working on a reply...