'AllPosts' page implemented in RSS design

main
Inga 🏳‍🌈 14 years ago
parent 88a8debd30
commit ac0cd67a0d
  1. 3
      Common/UserContext.cs
  2. 12
      templates/Rss/AllPosts.xslt
  3. 44
      templates/Rss/elems/Main.xslt
  4. 30
      templates/Rss/elems/PostInfo.xslt

@ -46,7 +46,8 @@ namespace FLocal.Common {
new XElement("hour", dateTime.Hour),
new XElement("minute", dateTime.Minute),
new XElement("second", dateTime.Second),
new XElement("ticks", dateTime.Ticks)
new XElement("ticks", dateTime.Ticks),
new XElement("rss", dateTime.ToString("o"))
);
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="elems\Main.xslt"/>
<xsl:import href="elems\PostInfo.xslt"/>
<xsl:template name="specificTitle">
<xsl:text>Âñå ñîîáùåíèÿ</xsl:text>
</xsl:template>
<xsl:template name="specific">
<xsl:apply-templates select="posts/post"/>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" />
<xsl:variable name="mainUrl">
<xsl:text>https://</xsl:text>
<xsl:value-of select="/root/url/host"/>
<xsl:text>:</xsl:text>
<xsl:if test="/root/url/port &gt;= 1000">
<xsl:value-of select="floor(/root/url/port div 1000)"/>
</xsl:if>
<xsl:text>443</xsl:text>
</xsl:variable>
<xsl:template match="/root">
<rss version="2.0">
<channel>
<title>RSS Title</title>
<description>
<xsl:call-template name="specificTitle"/>
</description>
<link>
<xsl:value-of select="$mainUrl"/>
<xsl:value-of select="currentUrl"/>
</link>
<lastBuildDate>
<xsl:apply-templates select="current" mode="dateTime"/>
</lastBuildDate>
<pubDate>
<xsl:apply-templates select="current" mode="dateTime"/>
</pubDate>
<xsl:call-template name="specific"/>
</channel>
</rss>
</xsl:template>
<xsl:template match="date" mode="dateTime">
<xsl:value-of select="rss"/>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="post">
<item>
<title>
<xsl:value-of select="title"/>
<xsl:text> îò </xsl:text>
<xsl:value-of select="poster/user/name"/>
</title>
<description>
<xsl:value-of select="bodyShort"/>
</description>
<link>
<xsl:value-of select="$mainUrl"/>
<xsl:text>/Post/</xsl:text>
<xsl:value-of select="id"/>
<xsl:text>/</xsl:text>
</link>
<guid>
<xsl:text>post-</xsl:text>
<xsl:value-of select="id"/>
</guid>
<pubDate>
<xsl:apply-templates select="postDate/date" mode="dateTime"/>
</pubDate>
</item>
</xsl:template>
</xsl:stylesheet>
Loading…
Cancel
Save