title: Limit the number of lines in XSLT item
body: <p>In SharePoint 2013, using Data View XSLT web part I want to limit the number of rows per item (not the number of items returned in general).
  I sow a few suggestions in JavaScript to find the div height and divide it in the line height property, but since I'm using XSL I wonder if there is any other way? I also looked for some solutions in CSS but there was nothing there.</p>
  
  <p>Here is the XSLT (I want to limit the number of lines I get from div "AdministrativePosts"):</p>
  
  <pre><code>&lt;Xsl&gt;
  &lt;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:ddwrt2="urn:frontpage:internal"&gt;
  &lt;xsl:output method="html" indent="no"/&gt;
  &lt;xsl:decimal-format NaN=""/&gt;
  &lt;xsl:param name="dvt_apos"&gt;&amp;apos;&lt;/xsl:param&gt;
  &lt;xsl:param name="ManualRefresh"&gt;&lt;/xsl:param&gt;&lt;xsl:variable name="dvt_1_automode"&gt;0&lt;/xsl:variable&gt;
  &lt;xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls"&gt;
  &lt;xsl:choose&gt;
  &lt;xsl:when test="($ManualRefresh = 'True')"&gt;
              &lt;table width="100%" border="0" cellpadding="0" cellspacing="0"&gt;
                  &lt;tr&gt;
                      &lt;td valign="top"&gt;
                          &lt;xsl:call-template name="dvt_1"/&gt;
                      &lt;/td&gt;
                      &lt;td width="1%" class="ms-vb" valign="top"&gt;
                          &lt;img src="/_layouts/15/images/staticrefresh.gif" id="ManualRefresh" border="0" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel')}" alt="Click here to refresh the dataview."/&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/xsl:when&gt;
              &lt;xsl:otherwise&gt;
                  &lt;xsl:call-template name="dvt_1"/&gt;
          &lt;/xsl:otherwise&gt;
                  &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;
  
              &lt;xsl:template name="dvt_1"&gt;
                  &lt;xsl:variable name="dvt_StyleName"&gt;Table&lt;/xsl:variable&gt;
                  &lt;xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/&gt;
                  &lt;xsl:variable name="RowLimit" select="1" /&gt;
                  &lt;div class="AdministrativePosts"&gt;                   
                      &lt;xsl:call-template name="dvt_1.body"&gt;
                          &lt;xsl:with-param name="Rows" select="$Rows"/&gt;
                          &lt;xsl:with-param name="FirstRow" select="1" /&gt;
                          &lt;xsl:with-param name="LastRow" select="$RowLimit" /&gt;
                      &lt;/xsl:call-template&gt;
              &lt;/div&gt;
          &lt;/xsl:template&gt;
                  &lt;xsl:template name="dvt_1.body"&gt;
                      &lt;xsl:param name="Rows"/&gt;
                      &lt;xsl:param name="FirstRow" /&gt;
                      &lt;xsl:param name="LastRow" /&gt;
                      &lt;xsl:for-each select="$Rows"&gt;
                          &lt;xsl:variable name="dvt_KeepItemsTogether" select="false()" /&gt;
                          &lt;xsl:variable name="dvt_HideGroupDetail" select="false()" /&gt;
                          &lt;xsl:if test="(position() &amp;gt;= $FirstRow and position() &amp;lt;= $LastRow) or $dvt_KeepItemsTogether"&gt;
                              &lt;xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1"&gt;
                                  &lt;xsl:call-template name="dvt_1.rowview" /&gt;
                          &lt;/xsl:if&gt;
                      &lt;/xsl:if&gt;
                  &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
                              &lt;xsl:template name="dvt_1.rowview"&gt;     
              &lt;xsl:value-of select="@Body" disable-output-escaping="yes"/&gt;
      &lt;/xsl:template&gt;
          &lt;/xsl:stylesheet&gt;&lt;/Xsl&gt;
  </code></pre>
  
  <p>And this the result:</p>
  
  <p><em>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</em></p>
  
  <p>But I want it to show only the first five lines never mind what the width of the div is, so characters limitation will not work here.</p>