In future, please use the xsl-list at www.mulberrytech.com for help with XSLT coding questions: this list is intended for questions that are specific to the Saxon implementation.
 
For fixed-size groups of size 3, try
 
group-adjacent="(position() - 1) idiv 3"
 
or
 
group-starting-with="*[position() mod 3 = 1]"
 
Michael Kay


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Jan Pour
Sent: 26 December 2005 23:28
To: saxon-help@lists.sourceforge.net
Subject: [saxon] fixed-size grouping

Hi all!
It seems to be an easy question, but it is tough for me...
Can you give me an example of this paragraph from W3C Candidate Recommendation 3 November 2005?:
 
In addition these facilities allow grouping based on sequential position, for example selecting groups of adjacent para elements. The facilities also provide an easy way to do fixed-size grouping, for example identifying groups of three adjacent nodes, which is useful when arranging data in multiple columns.
 
Input:
   <root>
      <photo>15</photo>
      <photo>2</photo>
      <photo>38</photo>
      <photo>4</photo>
      <photo>5</photo>
      <photo>6</photo>
      <photo>7</photo>
      <photo>8</photo>
      <photo>9</photo>
      <photo>10</photo>
   </root>
 
Output:
   <root>
      <group>
         <photo>15</photo>
         <photo>2</photo>
         <photo>38</photo>
      </group>
      <group>
         <photo>4</photo>
         <photo>5</photo>
         <photo>6</photo>
      </group>
      <group>
         <photo>7</photo>
         <photo>8</photo>
         <photo>9</photo>
      </group>
      <group>
         <photo>10</photo>
      </group>
   </root>
 
Thanks a lot!
Jan