Advertisement
Guest User

umbraco

a guest
Mar 6th, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.30 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE xsl:stylesheet [
  3.     <!ENTITY nbsp "&#x00A0;">
  4. ]>
  5. <xsl:stylesheet
  6.     version="1.0"
  7.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  8.     xmlns:msxml="urn:schemas-microsoft-com:xslt"
  9.     xmlns:umbraco.library="urn:umbraco.library"
  10.     exclude-result-prefixes="msxml umbraco.library">
  11.     <xsl:output method="xml" omit-xml-declaration="yes" />
  12.  
  13.     <xsl:include href="_pagination.xslt"/>
  14.  
  15.     <xsl:param name="currentPage"/>
  16.     <xsl:variable name="page" select="umbraco.library:RequestQueryString('page')" />
  17.  
  18.     <xsl:template match="/">
  19.         <xsl:variable name="matchedNodes" select="$currentPage/descendant::*[@isDoc]" />
  20.         <xsl:variable name="nodeCount" select="count($matchedNodes)" />
  21.         <xsl:if test="$nodeCount &gt; 0">
  22.             <xsl:variable name="page">
  23.                 <xsl:choose>
  24.                     <!-- first page -->
  25.                     <xsl:when test="number(umbraco.library:RequestQueryString('page')) &lt;= 1 or string(umbraco.library:RequestQueryString('page')) = '' or string(number(umbraco.library:RequestQueryString('page'))) = 'NaN'">
  26.                         <xsl:value-of select="number('1')" />
  27.                     </xsl:when>
  28.                     <!-- last page -->
  29.                     <xsl:when test="number(umbraco.library:RequestQueryString('page')) &gt; $nodeCount div $resultsPerPage">
  30.                         <xsl:value-of select="ceiling($nodeCount div $resultsPerPage)" />
  31.                     </xsl:when>
  32.                     <!-- the value specified in the url -->
  33.                     <xsl:otherwise>
  34.                         <xsl:value-of select="number(umbraco.library:RequestQueryString('page'))"/>
  35.                     </xsl:otherwise>
  36.                 </xsl:choose>
  37.             </xsl:variable>
  38.             <xsl:variable name="startMatch" select="($page - 1) * $resultsPerPage + 1" />
  39.             <xsl:variable name="endMatch">
  40.                 <xsl:choose>
  41.                     <!-- all the rest (on the last page) -->
  42.                     <xsl:when test="($page * $resultsPerPage) &gt; $nodeCount">
  43.                         <xsl:value-of select="$nodeCount" />
  44.                     </xsl:when>
  45.                     <!-- only the appropriate number for this page -->
  46.                     <xsl:otherwise>
  47.                         <xsl:value-of select="$page * $resultsPerPage" />
  48.                     </xsl:otherwise>
  49.                 </xsl:choose>
  50.             </xsl:variable>
  51.  
  52.             <xsl:if test="$matchedNodes">
  53.                 <xsl:apply-templates select="$matchedNodes">
  54.                     <xsl:sort select="@createDate" order="descending" data-type="text" />
  55.                     <xsl:with-param name="startMatch" select="$startMatch" />
  56.                     <xsl:with-param name="endMatch" select="$endMatch" />
  57.                 </xsl:apply-templates>
  58.             </xsl:if>
  59.  
  60.             <xsl:if test="$nodeCount &gt; $resultsPerPage">
  61.                 <xsl:call-template name="pagination">
  62.                     <xsl:with-param name="page" select="$page" />
  63.                     <xsl:with-param name="matchedNodes" select="$matchedNodes" />
  64.                 </xsl:call-template>
  65.             </xsl:if>
  66.  
  67.         </xsl:if>
  68.        
  69.     </xsl:template>
  70.  
  71.     <xsl:template match="*[@isDoc]">
  72.         <xsl:param name="startMatch" />
  73.         <xsl:param name="endMatch" />
  74.         <xsl:if test="position() &gt;= $startMatch and position() &lt;= $endMatch">
  75.             <br/><br/>
  76.        
  77.           <div id="main-wrapper">
  78.             <div id="main" class="container">
  79.             <div class="row">
  80.             <div class="12u skel-cell-mainContent">
  81.                 <div class="content" style="margin-left:130px">
  82.                     <!-- Content -->
  83.                     <article class="is-page-content">
  84.                        
  85.             <h3>
  86.                 <a href="{umbraco.library:NiceUrl(@id)}" style="text-decoration:none;color:#64AFD4;">
  87.                     <xsl:value-of select="@nodeName" />
  88.                 </a>
  89.             </h3>
  90. <xsl:choose>
  91.  
  92. <xsl:when test="./data [@alias = 'image'] != ''">
  93.  
  94.     <xsl:variable name="articlePhoto" select="umbraco.library:GetMedia(./data [@alias = 'image'], 0)" />
  95.     <div class="col-md-3">
  96.          <img src="$articlePhoto" />
  97.                 </div>
  98. </xsl:when>
  99.  
  100. <xsl:otherwise>
  101.         <div class="col-md-3">
  102.     <img  src="/media/1026/fake-logo.jpg" alt="{@nodeName}" style = "display:inline;width:230px;height:100px;" />
  103.         </div>
  104. </xsl:otherwise>
  105. </xsl:choose>
  106.             <div class="col-md-7">
  107.             <p>
  108.                 <xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(bodyText), 200, '...')" disable-output-escaping="yes"/>
  109.             </p>
  110.            
  111.                          <a href="{umbraco.library:NiceUrl(@id)}" class="button">Continue Reading</a><span style="color:gray;float:right"><xsl:value-of select="@updateDate" /></span>
  112.                         </div>
  113.                         </article>
  114.  
  115.                        
  116.                 </div>
  117.             </div>
  118.         </div>
  119.                     </div>
  120. </div>
  121.  
  122.         </xsl:if>
  123.     </xsl:template>
  124.  
  125. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement