Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4052198
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:17:24+00:00 2026-05-20T14:17:24+00:00

I have seen this asked in various places but never seen a workable solution

  • 0

I have seen this asked in various places but never seen a workable solution that doesn’t involve installing a new web-part (which I am unable to do).

I have a document library, which contains documents with a specific doctype which includes a value for “region”.

I have managed to alter the “CustomViewFields” parameter in the .webpart file and the ContentQueryMain.xsl, Itemstyle.xsl, HeaderStyle.xsl documents and use the CQWP’s grouping feature to produce the following output:

<div class="myDocuments">    
 <div class="group">
  <h2>My region</h2>
  <ul>
   <li>Document 1</li>
   <li>Document 2</li>
   <li>Document 3</li>
   <li>Document 4</li>
  </ul>
 </div>
 <div class="group">
  <h2>My other region</h2>
   <ul>
    <li>Document 1</li>
    <li>Document 2</li>
    <li>Document 3</li>
    <li>Document 4</li>
   </ul>
  </div>
</div>

This is all well and good, but I only want to display a maximum of three documents per region ordered by date.

I haven’t been able to work out any CAML query code which will achieve this, so I have been looking at using an if statement to drop any values once three have been created for the current region – but without knowing what the XML that the CQWP is exporting this is proving difficult.

At the moment this is how things are looking:

<xsl:if test="(count(preceding-sibling::Region = @Region)) &lt 3">
  <li><xsl:value-of select="{$Region}" /></li>
<xsl:if />

Any help would be greatly appreciated before I figuratively throw SharePoint out the window!

Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:17:25+00:00Added an answer on May 20, 2026 at 2:17 pm

    See the sample here: http://www.novolocus.com/2009/03/10/cqwp-show-the-first-item-in-each-group/

    It solved my problem in determining if the next item is already under another group/category.

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen this macro defined before but never really knew its purpose. Can
Sorry, I have seen this questioned asked a couple of times here already, but
I have seen this question asked here a few times, but most question didn't
I've seen this question asked before but it seems that the answer may be
I have seen this show up several places in code, never with an explanation,
I have seen this syntax in MSDN: yield break , but I don't know
Now I have seen this question in another forum but it didn't had an
I am pretty sure I have seen this before, but I haven't found out
I have asked this question countless times on various forums. Ultimately all I need
I've seen various questions regarding this issue, but there are a couple of questions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.