<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:pcm="urn:PageContentManager" xmlns:ddwrt2="urn:frontpage:internal" ddwrt:oob="true">
  <xsl:import href="/_layouts/15/xsl/main.xsl"/>
  <xsl:output method="html" indent="no"/>
  <xsl:param name="NoAJAX" select="1"/>
  <!-- Posts summary view (home page view)-->
  <xsl:template name="View_Blog_PostsSummary_RootTemplate" mode="RootTemplate" match="View[List/@TemplateType='301' and (@BaseViewID='7' or @BaseViewID='8' or @BaseViewID='9')]" ddwrt:dvt_mode="root">
    <xsl:apply-templates select="." mode="full" />
  </xsl:template>
  <!-- Links summary view (home page view)-->
  <xsl:template name="View_Blog_LinksSummary_RootTemplate" mode="RootTemplate" match="View[@BaseViewID='4' and List/@TemplateType='103']"  ddwrt:dvt_mode="root">
    <xsl:apply-templates select="." mode="full" />
  </xsl:template>
  <!-- BaseViewID='0' and TemplateType='301' is Home Page view for Blog's posts list -->
  <xsl:template match="View[@BaseViewID='0' and List/@TemplateType='301']" mode="full">
    <xsl:choose>
      <xsl:when test="$ClientRender='1'">
        <xsl:call-template name="CTXGeneration"/>
        <div id="script{$ContainerId}"></div>
        <div id="scriptPaging{$ContainerId}"></div>
      </xsl:when>
      <xsl:otherwise>
        <div>
          <xsl:apply-templates select="." mode="RenderView" />
        </div>
        <xsl:apply-templates mode="footer" select="." />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- BaseViewID='7' and TemplateType='301' is Posts.aspx view for Blog's posts list -->
  <xsl:template match="View[@BaseViewID='7' and List/@TemplateType='301']" mode="full">
    <xsl:choose>
      <xsl:when test="$ClientRender='1'">
        <xsl:call-template name="CTXGeneration"/>
        <div id="script{$ContainerId}"></div>
        <div id="scriptPaging{$ContainerId}"></div>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="RenderView" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- BaseViewID='8' and TemplateType='301' is Category.aspx view for Blog's posts list -->
  <!-- BaseViewID='9' and TemplateType='301' is Date.aspx view for Blog's posts list -->
  <xsl:template match="View[(@BaseViewID='8' or @BaseViewID='9') and List/@TemplateType='301']" mode="full">
    <xsl:choose>
      <xsl:when test="$ClientRender='1'">
        <xsl:call-template name="CTXGeneration"/>
        <div id="script{$ContainerId}"></div>
        <div id="scriptPaging{$ContainerId}"></div>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="count($Rows/Row[@_ModerationStatus. = 0]) = 0">
            <xsl:if test="@BaseViewID='8'">
                <div class="ms-PostWrapper">
                    <xsl:value-of select="$Rows/@resource.wss.blog_category_empty_text" />
                </div>
            </xsl:if>
            <xsl:if test="@BaseViewID='9'">
                <div class="ms-PostWrapper">
                    <xsl:value-of select="$Rows/@resource.wss.blog_monthview_empty_text" />
                </div>
            </xsl:if>
          </xsl:when>
          <xsl:otherwise>
            <div>
                <xsl:apply-templates select="." mode="RenderView" />
            </div>
            <xsl:apply-templates mode="footer" select="." />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="TemplateTagName">
    <xsl:choose>
        <xsl:when test="$XmlDefinition/@BaseViewID='0' and $XmlDefinition/List/@TemplateType='303'">ul</xsl:when>
        <xsl:otherwise>div</xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- BaseViewID='0' and TemplateType='302' is Home Page view for Blog's comments list -->
  <xsl:template match="View[@BaseViewID='0' and List/@TemplateType='302']" mode="full">
    <xsl:choose>
      <xsl:when test="$ClientRender='1'">
        <xsl:call-template name="CTXGeneration"/>
        <div id="script{$ContainerId}"></div>
        <div id="scriptPaging{$ContainerId}"></div>
      </xsl:when>
      <xsl:otherwise>  
        <div class="ms-commentsWrapper" >
          <a name="Comments"></a>
          <h3 class="ms-CommentHeader">
            <xsl:value-of select="$Rows/@resource.wss.comments_schema_blg_title"/>
          </h3>
          <xsl:choose>
            <xsl:when test="count($Rows/Row)= 0">
              <div class="ms-commentsempty">
                <xsl:value-of select="$Rows/@resource.wss.comments_xsl_blg_empty_text"/>
              </div>
            </xsl:when>
            <xsl:otherwise>
              <xsl:apply-templates select="." mode="RenderView" />
            </xsl:otherwise>
          </xsl:choose>
        </div>
        <xsl:call-template name="pagingButtons" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- BaseViewID='0' and TemplateType='303' is Home Page view for Blog's categories list -->
  <xsl:template match="View[@BaseViewID='0' and List/@TemplateType='303']" mode="full">
    <xsl:choose>
      <xsl:when test="$ClientRender='1'">
        <xsl:call-template name="CTXGeneration"/>
        <div id="script{$ContainerId}"></div>
        <div id="scriptPaging{$ContainerId}"></div>
      </xsl:when>
      <xsl:otherwise>  
        <div class="s4-ql menu vertical">
         <ul class="root static">
          <li class="static">
            <a class="static menu-item" href="{$HttpVDir}/{$Rows/@resource.wss.lists_Folder.web}/{$Rows/@resource.wss.blogcategories_Folder.web}/AllCategories.aspx">
                <span class="additional-background">
                <span class="menu-item-text">
                  <xsl:value-of select="$Rows/@resource.wss.categories_schema_blg_title"/>
                 </span>
                 </span>
            </a>
          <ul class="static" style="width:145px;margin:0px 0px 0px 0px;">
            <xsl:choose>
              <xsl:when test="count($Rows/Row)= 0">
                    <li class="static">
                      <xsl:value-of select="$Rows/@resource.wss.blog_empty_list_text"/>
                    </li>
              </xsl:when>
              <xsl:otherwise>
                  <xsl:apply-templates select="." mode="RenderView" />
              </xsl:otherwise>
            </xsl:choose>
            </ul>
            </li>
        </ul>
        <xsl:if test="$ListRight_AddListItems = '1'">
            <a class="static menu-item ms-addnew ms-blog-addnew" id="idBlogHomePageNewCategoryLink" style="text-decoration:none;" 
             onclick="NewItem2(event,'{$HttpVDir}/{$Rows/@resource.wss.lists_Folder.web}/{$Rows/@resource.wss.blogcategories_Folder.web}/NewCategory.aspx');return false;"
             href="{$HttpVDir}/{$Rows/@resource.wss.lists_Folder.web}/{$Rows/@resource.wss.blogcategories_Folder.web}/NewCategory.aspx" target="_self">
                <span class="additional-background">
                    <span class="menu-item-text">
                        <span class="ms-blog-addnew-img">
                            <span style="height:10px;width:10px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><img src="/_layouts/15/images/fgimg.png?rev=23" alt="" style="left:-0px !important;top:-32px !important;position:absolute;" border="0" /></span>
                        </span>
                        <xsl:value-of select="$Rows/@resource.wss.categories_AddNewCategory" />
                    </span>
                </span>
            </a>
        </xsl:if>
        </div>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- BaseViewID='4' and TemplateType='103' is Home Page view for Blog's links list -->
  <xsl:template match="View[@BaseViewID='4' and List/@TemplateType='103']" mode="full">
    <xsl:choose>
      <xsl:when test="$ClientRender='1'">
        <xsl:call-template name="CTXGeneration"/>
        <div id="script{$ContainerId}"></div>
        <div id="scriptPaging{$ContainerId}"></div>
      </xsl:when>
      <xsl:otherwise>  
        <div class="s4-ql menu vertical">
          <ul class="root static" >
            <li class="static" >
              <a class="static menu-item" href="{$ListUrlDir}/AllItems.aspx">
                <span class="additional-backgroud">
                  <span class="menu-item-text">
                    <xsl:value-of select="List/@title" />
                  </span>
                </span>
              </a>
              <ul class="static" style="width:145px;margin:0px 0px 0px 0px;">
                <xsl:choose>
                  <xsl:when test="count($Rows/Row)= 0">
                    <li class="static" style="padding:3px 4px 4px 10px;">
                      <xsl:value-of select="$Rows/@resource.wss.blog_empty_list_text"/>
                    </li>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:apply-templates select="." mode="RenderView" />
                  </xsl:otherwise>
                </xsl:choose>
              </ul>
            </li>
          </ul>
          <xsl:if test="$ListRight_AddListItems = '1'">
            <a class="static menu-item ms-addnew ms-blog-addnew" id="idHomePageNewLink" style="text-decoration:none;" 
               onclick="javascript:NewItem2(event, '{$ListUrlDir}/NewForm.aspx');javascript:return false;" 
               href="{$ListUrlDir}/NewForm.aspx" target="_self">
              <span class="additional-background">
                <span class="menu-item-text">
                  <span class="ms-blog-addnew-img">
                        <span style="height:10px;width:10px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><img src="/_layouts/15/images/fgimg.png?rev=23" alt="" style="left:-0px !important;top:-32px !important;position:absolute;" border="0" /></span>
                  </span>
                  <xsl:value-of select="$Rows/@resource.wss.AddNewLink" />
                </span>
              </span>
            </a>
          </xsl:if>
        </div>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="View[List/@TemplateType='301' and (@BaseViewID='0' or @BaseViewID='8' or @BaseViewID='9')]" mode="footer">
    <xsl:call-template name="pagingButtons" />
    <xsl:if test="List/@EnableSyndication=1">
      <div class="ms-blogrss" id="BlogRSSMain">
        <span style="vertical-align:middle">
          <span style="height:16px;width:16px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><a href="{$HttpVDir}/_layouts/15/listfeed.aspx?List={$List}" style="height:16px;width:16px;display:inline-block;" ><img src="/_layouts/15/images/fgimg.png?rev=23" alt="{$Rows/@resource.wss.blog_rss_link}" style="left:-0px !important;top:-411px !important;position:absolute;" title="{$Rows/@resource.wss.blog_rss_link}" align="absmiddle" /></a></span>
        </span>
        <a href="{$HttpVDir}/_layouts/15/listfeed.aspx?List={$List}">
        <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
        <xsl:value-of select="$Rows/@resource.wss.blog_rss_link"/>
        </a>
      </div>
      <xsl:variable name="scriptbody1">      
        var divBlogRSSNav = document.getElementById("BlogRSSNav");
        var divBlogRSSMain = document.getElementById("BlogRSSMain");
        if (divBlogRSSNav != null &amp;&amp; divBlogRSSMain != null)
        {
        divBlogRSSNav.innerHTML = divBlogRSSMain.innerHTML;
        divBlogRSSNav.className = "ms-blogrssnav";
        divBlogRSSMain.parentNode.removeChild(divBlogRSSMain);
        }
     </xsl:variable>
     <xsl:value-of select="pcm:RegisterScriptBlock('block1', string($scriptbody1))"/>
    </xsl:if>
    <xsl:if test="$EnableAlert">
    <div class="ms-blogrss" >
        <a href="{$HttpVDir}/_layouts/15/SubNew.aspx?List={$List}&amp;Source={$HttpVDir}%2Fdefault.aspx" longDesc="{$Rows/@resource.wss.ToolBarMenuItemAlertMe}">
          <img src="/_layouts/15/images/menualert.gif?rev=23" alt="{$Rows/@resource.wss.ToolBarMenuItemAlertMe}" title="{$Rows/@resource.wss.ToolBarMenuItemAlertMe}" align="absmiddle" height="16px" width="16px"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$Rows/@resource.wss.ToolBarMenuItemAlertMe"/>
        </a>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- BaseViewID='0' and TemplateType='301' is Home Page view for Blog's posts list -->
  <xsl:template mode="Item" match="Row[../../@TemplateType='301' and (../../@BaseViewID='0' or ../../@BaseViewID='7' or ../../@BaseViewID='8' or ../../@BaseViewID='9')]">
    <xsl:param name="Fields" select="."/>
    <xsl:param name="Collapse" select="."/>
    <xsl:param name="Position" select="1"/>
    <xsl:param name="Last" select="1"/>
    <!-- Posts.aspx and the home page should show the body of the post -->
    <xsl:variable name="ShowBody"><xsl:if test="../../@BaseViewID='0' or ../../@BaseViewID='7'">1</xsl:if></xsl:variable>
    <!-- Posts.aspx and the home page should show the post date above the posts-->
    <xsl:variable name="ShowTopDate"><xsl:if test="../../@BaseViewID='0' or ../../@BaseViewID='7'">1</xsl:if></xsl:variable>
    <!-- Posts.aspx should show draft posts-->
    <xsl:variable name="ShowDrafts"><xsl:if test="../../@BaseViewID='7'">1</xsl:if></xsl:variable>
    <xsl:variable name="thisNode" select="."/>
    <xsl:if test="$ContainerId">
        <xsl:text disable-output-escaping="yes">&lt;!--&lt;#  if (listItem["_ModerationStatus"] != '')
          {#&gt; --&gt;
        </xsl:text>    
    </xsl:if>
    <xsl:if test="$ShowDrafts=1 or $thisNode/@_ModerationStatus. = 0 or $ContainerId">
      <table>
      <tr class="ms-blogpostdatecol" valign="top">
      <td class= "ms-leftblogdate">
        <div id="PostDateTopBox" class="ms-postcalendardateboxtop">
        </div>
        <div id="PostDateBottomBox" class="ms-postcalendardateboxbottom" style="overflow-x:hidden">
        <div>
        <xsl:value-of select="$thisNode/@PublishedDate.MonthDayOnly" disable-output-escaping="yes" />
        </div>
        </div>
      </td>
      <td class = "ms-rightblogpost">
        <table dir="None" cellspacing="0" cellpadding="0" width="100%" border="0">
          <tbody>
            <tr>
              <td class="ms-PostTitle">
                <xsl:variable name="PostTitle" select="translate($thisNode/@Title, '&quot;#%&amp;*:&lt;&gt;?\/{|}~. ', '-----------------')" />
                <a href="{$HttpVDir}/{$thisNode/../@resource.cms.PublishingBlogBlogText}/{$thisNode/../@resource.cms.PublishingBlogPostText}/{$thisNode/@ID}/{$PostTitle}">
                  <xsl:apply-templates select="$Fields[@Name='Title']" mode="PrintField">
                    <xsl:with-param name="thisNode" select="$thisNode"/>
                    <xsl:with-param name="Position" select="$Position"/>
                  </xsl:apply-templates>
                </a>
              </td>
              <!-- Only the Posts.aspx view should show the edit button -->
              <xsl:if test="../../@BaseViewID='7'">
                <!-- Handle _edit only their own_ property on list -->
                <xsl:if test="($thisNode/../@value.listpermission.EditListItems = '1' and (($thisNode/../@value.listpermission.ManageLists  = '1') or ($XmlDefinition/List/@WriteSecurity = '2' and $thisNode/@Author.id = $Userid) or ($XmlDefinition/List/@WriteSecurity != '2')))">
                  <td align="right" class="ms-blogedit">
                    <a href="javascript:" onclick="javascript:ShowPopupDialog('{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogpost_Folder.web}/EditPost.aspx?ID={$thisNode/@ID}&amp;Source={$HttpVDir}%2Fdefault.aspx');">
                      <xsl:value-of select="$thisNode/../@resource.wss.blog_edit" />
                    </a>
                  </td>
                </xsl:if>
              </xsl:if>
            </tr>
          </tbody>
        </table>
        <!-- Show the author, published date and category information below post title -->
        <div class="ms-PostFooter">
                <!-- For the author field, render it using the span style and preceed it with the word "by"-->
                <span class="ms-postfootercolor"><xsl:value-of select="$thisNode/../@resource.wss.ByPrefix"/></span><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:call-template name="RenderAuthor"/>
                <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><span class="ms-postfootercolor"><xsl:value-of select="$thisNode/../@resource.wss.blog_postfooter_at"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
                <xsl:choose>
                    <xsl:when test="$ContainerId"><xsl:text disable-output-escaping="yes">&lt;#= spMgr.RenderFieldByName("PublishedDate", listItem, listSchema) #&gt;</xsl:text></xsl:when>
                    <xsl:otherwise><xsl:value-of select="@PublishedDate" disable-output-escaping="yes"/></xsl:otherwise>      
                </xsl:choose></span>
        <div>
          <xsl:choose>
            <xsl:when test="$ContainerId">
                <xsl:text disable-output-escaping="yes">&lt;!--&lt;#  if (listItem.PostCategory != '')
                  {#&gt; --&gt;
                </xsl:text>    
                <xsl:value-of select="$thisNode/../@resource.wss.posts_schema_blgfld_category" /><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">:&amp;nbsp;</xsl:text>
                <xsl:text disable-output-escaping="yes">&lt;#= spMgr.RenderFieldByName("PostCategory", listItem, listSchema) #&gt;</xsl:text>
              <xsl:text disable-output-escaping="yes">
                &lt;!-- &lt;# } #&gt; --&gt;
              </xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="@Name='PostCategory' and not ($thisNode/@PostCategory='')">
                <!-- output the PostCategory field as "Category: " followed by the categories -->
                <xsl:value-of select="$thisNode/../@resource.wss.posts_schema_blgfld_category" /><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">:&amp;nbsp;</xsl:text><xsl:apply-templates select="$Fields[@Name='CategoryWithLink']" mode="Computed_body"><xsl:with-param name="thisNode" select="$thisNode"/></xsl:apply-templates>
                </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
        </div>
      </div>
        <xsl:if test="$ShowBody=1">
          <div class="ms-PostBody">
            <div>
              <xsl:apply-templates select="$Fields[@Name='Body']" mode="PrintField">
                <xsl:with-param name="thisNode" select="$thisNode"/>
                <xsl:with-param name="Position" select="$Position"/>
              </xsl:apply-templates>
            </div>
          </div>
        </xsl:if>
        <div class="ms-PostFooter">
          <xsl:for-each select="$Fields">            
            <!-- skip the title field, any note fields (ie: Body), and the field value isn't empty -->
            <!-- skip the title field, any note fields (ie: Body), and the field value isn't empty -->
            <xsl:if test="@Name ='Permalink' or @Name ='EmailPostLink' or @Name ='NumCommentsWithLink'">
            <xsl:choose>
              <!-- print these well known fields, even thought they don't have a value per se-->
              <xsl:when test="@Name='Permalink' or @Name='EmailPostLink' or @Name='NumCommentsWithLink'"><xsl:apply-templates select="." mode="PrintFieldWithDisplayFormLink"><xsl:with-param name="thisNode" select="$thisNode"/><xsl:with-param name="Position" select="$Position"/></xsl:apply-templates><xsl:if test="@Name='Permalink' or @Name='EmailPostLink'"><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;|&amp;nbsp;</xsl:text></xsl:if></xsl:when>
              <!-- print the rest of the fields as normal if they have a value -->
              <xsl:when test="$thisNode/@*[name()=current()/@Name]!=''"><xsl:apply-templates select="." mode="PrintFieldWithDisplayFormLink"><xsl:with-param name="thisNode" select="$thisNode"/><xsl:with-param name="Position" select="$Position"/></xsl:apply-templates><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;|&amp;nbsp;</xsl:text></xsl:when>
            </xsl:choose>
            </xsl:if>
          </xsl:for-each>
        </div>
          </td>
    </tr>
    </table>
    </xsl:if>
    <xsl:if test="$ContainerId">
        <xsl:text disable-output-escaping="yes">
        &lt;!-- &lt;# } #&gt; --&gt;
      </xsl:text>
    </xsl:if>
  </xsl:template>
  <!-- baseviewid = 0 and templatetype='302' is blog's comments list-->
  <xsl:template mode="Item" match="Row[../../@BaseViewID='0' and ../../@TemplateType='302']">
    <xsl:param name="Fields" select="."/>
    <xsl:param name="Collapse" select="."/>
    <xsl:param name="Position" select="1"/>
    <xsl:param name="Last" select="1"/>
    <xsl:variable name="thisNode" select="."/>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" dir="None" class="ms-commenttable">
      <tr>
        <td width="690">
          <h4 class="ms-CommentTitle">
            <xsl:apply-templates select="$Fields[@Name='Title']" mode="PrintField">
              <xsl:with-param name="thisNode" select="."/>
              <xsl:with-param name="Position" select="$Position"/>
            </xsl:apply-templates>
          </h4>
        </td>
        <xsl:if test="($thisNode/../@value.listpermission.EditListItems = '1' and (($thisNode/../@value.listpermission.ManageLists  = '1') or ( $thisNode/@Author.id = $Userid) or ($XmlDefinition/List/@WriteSecurity != '2')))">
          <td align="right" class="ms-blogedit">
            <a href="javascript:" onclick='ShowPopupDialog("{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogcomments_Folder.web}/EditComment.aspx?ID={$thisNode/@ID}&amp;Source={$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogpost_Folder.web}/Post.aspx?ID={$thisNode/@PostID}");return false;'>
              <xsl:value-of select="$thisNode/../@resource.wss.blog_edit" />
            </a>
          </td>
        </xsl:if>
      </tr>
    </table>
    <div class="ms-CommentBody">
      <div dir="">
        <xsl:apply-templates select="$Fields[@Name='Body']" mode="PrintField">
          <xsl:with-param name="thisNode" select="."/>
          <xsl:with-param name="Position" select="$Position"/>
        </xsl:apply-templates>
      </div>
    </div>
    <div class="ms-CommentFooter">
      <xsl:choose>
        <xsl:when test="$ContainerId"><xsl:text disable-output-escaping="yes">&lt;#= spMgr.RenderFieldByName("Author", listItem, listSchema) #&gt;</xsl:text></xsl:when>
        <xsl:otherwise><xsl:value-of select="$thisNode/@Author.span" disable-output-escaping="yes"/></xsl:otherwise>      
      </xsl:choose><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$thisNode/../@resource.wss.comments_At" /><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><span dir="ltr">
      <xsl:choose>
        <xsl:when test="$ContainerId"><xsl:text disable-output-escaping="yes">&lt;#= spMgr.RenderFieldByName("Created", listItem, listSchema) #&gt;</xsl:text></xsl:when>
        <xsl:otherwise><xsl:value-of select="$thisNode/@Created"/></xsl:otherwise>      
      </xsl:choose>
      </span>
    </div>
  </xsl:template>
  <xsl:template name="RenderAuthor">
    <xsl:choose>
        <xsl:when test="$ContainerId"><xsl:text disable-output-escaping="yes">&lt;#= spMgr.RenderFieldByName("Author", listItem, listSchema) #&gt;</xsl:text></xsl:when>
        <xsl:otherwise><xsl:value-of select="@Author.span" disable-output-escaping="yes"/></xsl:otherwise>      
     </xsl:choose>
  </xsl:template>
  <!-- baseviewid = 0 and templatetype='303' is blog's categories list-->
  <!-- BaseViewID='4' and TemplateType='103' is Home Page view for Blog's links list -->
  <xsl:template mode="Item" match="Row[(../../@BaseViewID='0' and ../../@TemplateType='303') or (../../@BaseViewID='4' and ../../@TemplateType='103')]">
    <xsl:param name="Fields" select="."/>
    <xsl:param name="Collapse" select="."/>
    <xsl:param name="Position" select="1"/>
    <xsl:param name="Last" select="1"/>
    <xsl:variable name="thisNode" select="."/>
      <xsl:if test="(../../@BaseViewID='0' and ../../@TemplateType='303')">
        <xsl:for-each select="$Fields">
          <li class="static">
            <xsl:apply-templates select="." mode="PrintField">
              <xsl:with-param name="thisNode" select="$thisNode"/>
              <xsl:with-param name="Position" select="$Position"/>
            </xsl:apply-templates>
          </li>
        </xsl:for-each>
      </xsl:if>
      <xsl:if test="(../../@BaseViewID='4' and ../../@TemplateType='103')">
        <xsl:for-each select="$Fields">
          <li class="static">
            <xsl:apply-templates select="." mode="PrintField">
              <xsl:with-param name="thisNode" select="$thisNode"/>
              <xsl:with-param name="Position" select="$Position"/>
            </xsl:apply-templates>
          </li>
        </xsl:for-each>
      </xsl:if>
  </xsl:template>
  <!-- NumComments from Blog (Posts) => e136aa19-e8d1-1b3c-a32c-aba3e58a971b -->
  <xsl:template name="FieldRef_Blog_NumComments_Lookup_body" match="FieldRef[@ID='e136aa19-e8d1-1b3c-a32c-aba3e58a971b']" ddwrt:dvt_mode="body" mode="Lookup_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:value-of select="$thisNode/@*[name()=current()/@Name]"/>
  </xsl:template>
  <!-- PostCategory from Blog (Posts) => 38bea83b-350a-1a6e-f34a-93a6af31338b -->
  <xsl:template name="FieldRef_Blog_PostCategory_Lookup_body" match="FieldRef[@ID='38bea83b-350a-1a6e-f34a-93a6af31338b']" ddwrt:dvt_mode="body" mode="Lookup_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" />
  </xsl:template>
  <!-- CategoryID from Blog (Posts) => a194bd80-24e6-e71b-b235-3a283b9f1e71 -->
  <xsl:template name="FieldRef_Blog_CategoryID_Computed_Body" match="FieldRef[@ID='a194bd80-24e6-e71b-b235-3a283b9f1e71']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:variable name="nodeval" select="normalize-space($thisNode/@*[name()=current()/@Name])" />
    <xsl:variable name="LookupId" select="normalize-space(substring-before($nodeval,';#'))" />
    <xsl:variable name="LookupValue" select="normalize-space(substring-after($nodeval,';#'))" />
    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogcategories_Folder.web}/ViewCategory.aspx?ID={$LookupId}&amp;RootFolder=*">
      <xsl:value-of select="$LookupValue" disable-output-escaping="yes"/>
    </a>
  </xsl:template>
  <!-- Permalink from Blog (Posts) => a194bd80-24e6-e71b-b235-3a283b9f1e71 -->
  <xsl:template name="FieldRef_Blog_Permalink_Computed_Body" match="FieldRef[@ID='a194bd80-24e6-e71b-b235-3a283b9f1e71']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
      <xsl:variable name="PostTitle" select="translate($thisNode/@Title, '&quot;#%&amp;*:&lt;&gt;?\/{|}~. ', '-----------------')" />
      <span style="vertical-align:middle">
      <span style="height:16px;width:16px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><a href="{$HttpVDir}/{$thisNode/../@resource.cms.PublishingBlogBlogText}/{$thisNode/../@resource.cms.PublishingBlogPostText}/{$thisNode/@ID}/{$PostTitle}" style="height:16px;width:16px;display:inline-block;" ><img src="/_layouts/15/images/fgimg.png?rev=23" alt="{$thisNode/../@resource.wss.posts_permlink_alt}" style="left:-0px !important;top:-348px !important;position:absolute;" title="{$thisNode/../@resource.wss.posts_permlink_alt}" class="imglink" longDesc="{$thisNode/../@resource.wss.posts_permlink_alt}" /></a></span>
      </span>
  </xsl:template>
  <!-- PostedByWithDate from Blog (Posts) => a1944d80-14e6-a71c-b235-3a28329f14b1 -->
  <xsl:template name="FieldRef_Blog_PostedByWithDate_Computed_Body" match="FieldRef[@ID='a1944d80-14e6-a71c-b235-3a28329f14b1']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:value-of select="$thisNode/../@resource.wss.blog_posts_postedat_begin"/><xsl:value-of select="$thisNode/@PublishedDate.TimeOnly" disable-output-escaping="yes" /><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$thisNode/../@resource.wss.2000"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$thisNode/@Author.span" disable-output-escaping="yes"/>
  </xsl:template>
  <!-- CategoryWithLink from Blog (Posts) => 7b946681-13a6-a72c-b335-3a96b29f1972 -->
  <xsl:template name="FieldRef_Blog_PostCategoryWithLink_Computed_Body" match="FieldRef[@ID='7b946681-13a6-a72c-b335-3a96b29f1972']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:param name="value" select="''" />
    <xsl:choose>
      <xsl:when test="$value='' and $thisNode/@PostCategory. != ''">
        <xsl:call-template name="FieldRef_Blog_PostCategoryWithLink_Computed_Body">
          <xsl:with-param name="thisNode" select="$thisNode"/>
          <xsl:with-param name="value" select="normalize-space($thisNode/@PostCategory.)"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <!-- 1;#Category 1;#2;#Category 2;#3;#Category 3 -->
        <xsl:variable name="LookupId" select="normalize-space(substring-before($value,';#'))" />
        <xsl:variable name="AfterLookupId" select="normalize-space(substring-after($value,';#'))" />
        <xsl:variable name="LookupValue" select="normalize-space(substring-before($AfterLookupId,';#'))" />
        <xsl:variable name="Leftovers" select="normalize-space(substring-after($AfterLookupId,';#'))" />
        <xsl:variable name="LookupValueFinal">
        <xsl:choose>
          <xsl:when test="$LookupValue != ''">
            <xsl:value-of select="ddwrt:UrlEncode(string($LookupValue))"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="ddwrt:UrlEncode(string($AfterLookupId))"/>
          </xsl:otherwise>
        </xsl:choose>
        </xsl:variable>
        <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogcategories_Folder.web}/Category.aspx?CategoryId={$LookupId}&amp;Name={$LookupValueFinal}">
          <xsl:choose>
            <xsl:when test="$LookupValue != ''">
              <xsl:value-of select="$LookupValue"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$AfterLookupId"/>
            </xsl:otherwise>
          </xsl:choose>
        </a>
        <xsl:if test="$Leftovers != ''">
          <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">;&amp;nbsp;</xsl:text>
          <xsl:call-template name="FieldRef_Blog_PostCategoryWithLink_Computed_Body">
            <xsl:with-param name="thisNode" select="$thisNode"/>
            <xsl:with-param name="value" select="$Leftovers"/>
          </xsl:call-template>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- NumCommentsWithLink from Blog (Posts) => 65746b4a-13a6-a72c-b815-3a96b29f1f9e -->
  <xsl:template name="FieldRef_Blog_NumCommentsWithLink_Computed_Body" match="FieldRef[@ID='65746b4a-13a6-a72c-b815-3a96b29f1f9e']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
      <span style="vertical-align:middle">
      <span style="height:16px;width:16px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogpost_Folder.web}/Post.aspx?ID={$thisNode/@ID}" style="height:16px;width:16px;display:inline-block;" ><img src="/_layouts/15/images/fgimg.png?rev=23" alt="{$thisNode/../@resource.wss.posts_numcommentswithlink_alt}" style="left:-0px !important;top:-332px !important;position:absolute;" title="{$thisNode/../@resource.wss.posts_numcommentswithlink_alt}" class="imglink" longDesc="{$thisNode/../@resource.wss.posts_numcommentswithlink_alt}" /></a></span>    
      </span>
      <span>
    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogpost_Folder.web}/Post.aspx?ID={$thisNode/@ID}">      
    <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
    <xsl:value-of select="$thisNode/@NumComments" />
    <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
    <xsl:value-of select="$thisNode/../@resource.wss.num_comments_blg_post"/>
    </a>
    </span>
  </xsl:template>
  <!-- EmailPostLink from Blog (Posts) => 1c216b4a-13a6-cd5c-b37b-3776b29ff92e -->
  <xsl:template name="FieldRef_Blog_EmailPostLink_Computed_Body" match="FieldRef[@ID='1c216b4a-13a6-cd5c-b37b-3776b29ff92e']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
      <span style="vertical-align:middle">
      <span style="height:16px;width:16px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><a href="javascript:navigateMailToLink('{$HttpVDir}%2F{$thisNode/../@resource.wss.lists_Folder.web}%2F{$thisNode/../@resource.wss.blogpost_Folder.web}%2FPost.aspx?ID%3D{$thisNode/@ID}')" style="height:16px;width:16px;display:inline-block;" ><img src="/_layouts/15/images/fgimg.png?rev=23" alt="{$thisNode/../@resource.wss.posts_emailpostlink_alt}" style="left:-0px !important;top:-203px !important;position:absolute;" title="{$thisNode/../@resource.wss.posts_emailpostlink_alt}" class="imglink" longDesc ="{$thisNode/../@resource.wss.posts_emailpostlink_alt}" /></a></span>
      </span>
  </xsl:template>
  <!-- CategoryWithLink from Blog (Categories) => 7b94c1d8-13a8-a72c-c125-3a96e89f1992 -->
  <xsl:template name="FieldRef_Blog_CategoryWithLink_Computed_Body" match="FieldRef[@ID='7b94c1d8-13a8-a72c-c125-3a96e89f1992']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:choose>
      <xsl:when test="($thisNode/../../@BaseViewID='0' and $thisNode/../../@TemplateType='303')">
        <a class="static menu-item" href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogcategories_Folder.web}/Category.aspx?CategoryId={$thisNode/@ID}&amp;Name={ddwrt:UrlEncode(string($thisNode/@Title))}" id="blgcat{$thisNode/@ID}">
          <span class="additional-backgroud"><span class="menu-item-text"><xsl:value-of select="$thisNode/@Title"/></span></span>
        </a>
      </xsl:when>
      <xsl:otherwise>
        <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogcategories_Folder.web}/Category.aspx?CategoryId={$thisNode/@ID}&amp;Name={ddwrt:UrlEncode(string($thisNode/@Title))}" id="blgcat{$thisNode/@ID}">
          <xsl:value-of select="$thisNode/@Title"/>
        </a> 
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- PostTitle from blog (comments) => a131e489-d3d6-4f0c-a152-a3beb89f12be -->
  <xsl:template name="FieldRef_Blog_PostTitle_Lookup_body" match="FieldRef[@ID='a131e489-d3d6-4f0c-a152-a3beb89f12be']" ddwrt:dvt_mode="body" mode="Lookup_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:variable name="nodeval" select="normalize-space($thisNode/@PostTitle.)" />
    <xsl:variable name="LookupId" select="normalize-space(substring-before($nodeval,';#'))" />
    <xsl:variable name="LookupValue" select="normalize-space(substring-after($nodeval,';#'))" />
    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogpost_Folder.web}/Post.aspx?ID={$LookupId}&amp;RootFolder=*">
      <xsl:value-of select="$LookupValue"/>
    </a>
  </xsl:template>
  <!-- PostID from blog (comments) => b63172be-d3d6-3f8e-854a-74ef89972eea -->
  <xsl:template name="FieldRef_Blog_PostID_Lookup_body" match="FieldRef[@ID='b63172be-d3d6-3f8e-854a-74ef89972eea']" ddwrt:dvt_mode="body" mode="Lookup_body">
    <xsl:param name="thisNode" select="."/>
    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder.web}/{$thisNode/../@resource.wss.blogpost_Folder.web}/Post.aspx?ID={$thisNode/@ID}">
      <xsl:value-of select="$thisNode/@ID"/>
    </a>
  </xsl:template>
</xsl:stylesheet>
