Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas Kahn 602 posts 506 karma points
    Dec 08, 2009 @ 16:30
    Thomas Kahn
    0

    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

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 08, 2009 @ 16:46
    Sebastiaan Janssen
    0

    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.. ;-)

  • Chad Rosenthal 272 posts 474 karma points
    Dec 08, 2009 @ 16:47
    Chad Rosenthal
    0

    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>

  • Petr Snobelt 923 posts 1535 karma points
    Dec 08, 2009 @ 16:51
    Petr Snobelt
    0

    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

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Dec 08, 2009 @ 18:21
    Douglas Robar
    1

    And for the definitive answers... check out your options here: http://our.umbraco.org/forum/using/ui-questions/5255-301-redirect-options

    cheers,
    doug.

  • Thomas Kahn 602 posts 506 karma points
    Dec 09, 2009 @ 09:09
    Thomas Kahn
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft