Created
September 18, 2012 06:33
-
-
Save netsi1964/3741577 to your computer and use it in GitHub Desktop.
Various XSLT stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:msxsl="urn:schemas-microsoft-com:xslt" | |
xmlns:user="urn:my-scripts" | |
exclude-result-prefixes="xsl msxsl user" | |
> | |
<msxsl:script language="C#" implements-prefix="user"> | |
<msxsl:assembly name="System.Web" /> | |
<msxsl:using namespace="System.Web" /> | |
<![CDATA[ | |
public void RedirectTo(string Location){ | |
Response.Status = "301 Moved Permanently"; | |
Response.AddHeader("Location", Location); | |
Response.End(); | |
}]]> | |
</msxsl:script> | |
<xsl:template match="/"> | |
<!-- Make a redirect using C# --> | |
<xsl:value-of select="user:RedirectTo('/')" /> | |
<!-- | |
Prevent empty or self closing content | |
*[not(normalize-space() = '')] | |
Examples: | |
--> | |
<xsl:copy-of select="*[not(normalize-space() = '')]" /> | |
<xsl:value-of select="*[not(normalize-space() = '')]" /> | |
</xsl:template> | |
</xsl:stylesheet> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment