Created
September 17, 2012 20:42
-
-
Save Novakov/3739658 to your computer and use it in GitHub Desktop.
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:msxsl="urn:schemas-microsoft-com:xslt" | |
exclude-result-prefixes="msxsl" | |
xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:funcs="urn:funcs" | |
> | |
<xsl:output method="html" indent="yes"/> | |
<msxsl:script language="C#" implements-prefix="funcs"> | |
<![CDATA[ | |
public string formatDate(string text, string format) | |
{ | |
return DateTime.Parse(text).ToString(format); | |
} | |
]]> | |
</msxsl:script> | |
<xsl:template match="Posts"> | |
<table> | |
<thead> | |
<tr> | |
<th>Title</th> | |
<th>Path</th> | |
<th>Publish date</th> | |
<th>Summary</th> | |
</tr> | |
</thead> | |
<tbody> | |
<xsl:apply-templates select="Post" /> | |
</tbody> | |
</table> | |
</xsl:template> | |
<xsl:template match="Post"> | |
<tr> | |
<td> | |
<xsl:value-of select="@Title"/> | |
</td> | |
<td> | |
<xsl:value-of select="@Path"/> | |
</td> | |
<td> | |
<xsl:value-of select="funcs:formatDate(@PublishDate, 'yyyy-MM-dd HH:mm:ss')"/> | |
</td> | |
<td> | |
<xsl:value-of select="@Summary"/> | |
</td> | |
</tr> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment