[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Grouping Issue?

Subject: RE: Grouping Issue?
From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx>
Date: Wed, 21 Aug 2002 09:58:27 +0100
grouping issue
You could try this, its a bit noddy and hard coded but if you are sure
of your data it should be ok.

First, select every third <month>

<xsl:template match="tripdates">
  <xsl:apply-templates select="month[position() mod 3 = 1]"/>
</xsl:template>

Output a row of that <month> and the following two <month>s

<xsl:template match="month">
  <tr>
  <xsl:apply-templates select="." mode="table"/>
  <xsl:apply-templates select="following-sibling::month[1]"
mode="table"/>
  <xsl:apply-templates select="following-sibling::month[2]"
mode="table"/>
  </tr>
</xsl:template>

Output the <td>'s for each <month>
<xsl:template match="month" mode="table">
  <td><xsl:value-of select="."/></td>
</xsl:template>


It wouldnt be very hard to use a variable instead of hard coded value's
- you would just need to modify the unmoded month template, probably
with a call to a named template that would recursively apply-templates
to the following-siblings.  If you get stuck I can show you that.

cheers
andrew


> -----Original Message-----
> From: Josh Campbell [mailto:josh@xxxxxxxxxx]
> Sent: 21 August 2002 03:53
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Grouping Issue?
> 
> 
> I am trying to get the following XML to be presented in rows of 3 
> months. The months are represented as headings with the dates listed 
> underneath.
> 
> I'm pretty sure it's a grouping issue but I can't get my head 
> around how 
> this works. Basically every 3 months I want to start a new row.
> 
> <tripdates>
>        <month name="October">
>             <date>Wednesday 9th</date>
>              <date>Thursday 10th</date>
>         </month>
>         <month name="November">
>               <date>Saturday 2nd</date>
>               <date>Sunday 3rd</date>
>          </month>
>          <month name="December">
>                <date>Sunday 22nd</date>
>          </month>
>          <month name="January">
>                <date>Sunday 22nd</date>
>          </month>
> </tripdates>
> 
> This is the XSL I've got to lay the months out but at the moment it's 
> simply just putting them into one row.
> 
> <xsl:template match="tripdates">
>     <div class="tourrow">
>             <xsl:for-each select="month">
>                 <div class="monthpos">
>                     <h3><xsl:value-of select="@name"/></h3>
>                     <xsl:for-each select="date">
>                         <div class="tourdate"><xsl:value-of 
> select="."/></div>
>                     </xsl:for-each>
>                 </div>
>             </xsl:for-each>
>         </div>
> </xsl:template>
> 
> Any ideas on this?
> 
> Thanks
> Josh
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002
>  
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002
 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.