title: sharepoint dataview webpart xslt group by left characters of a column
body: <p>I have a sharepoint 2010 list with a column "proposalID". The values in that column are 
  5555-01, 5555-02, 5555-03, 6666-01, 6666-02, etc.</p>
  
  <p>I want to group by the 4 characters to the left of the dash.  So the grouping would display 3 items under 5555 and 2 items under the group 6666, etc.</p>
  
  <p>Using Sharepoint Designer 2010, I added a blank dataview webpart, connected to my list, and from the ribbon chose to sort by the Proposal ID column.  It rendered the below xsl ddwrt code:</p>
  
  <p>I've been trying various syntax to change the string function but have not been successful.  I tried to glean some knowledge from this posting, <a href="http://jamestsai.net/Blog/post/SharePoint-Data-View-Data-Form-Web-Part-Group-items-by-month-on-DateTime-field.aspx" rel="nofollow">http://jamestsai.net/Blog/post/SharePoint-Data-View-Data-Form-Web-Part-Group-items-by-month-on-DateTime-field.aspx</a> - but was not able to apply the string syntax to my case.</p>
  
  <p>Could someone suggest how I can accomplish this grouping?  Thank you in advance.</p>
  
  <pre><code>&lt;xsl:choose&gt;
    &lt;xsl:when test="not ($dvt_groupfield)"&gt;
      &lt;xsl:value-of select="ddwrt:NameChanged(string(@ProposalID), 0)" /&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;&lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  </code></pre>