[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Grouping by distinct combinations of descendant e
<xsl:for-each-group select="$ap-groups" group-by="xx:get-dates(Appointment/@Date,'')"> should be replaced by a simple call to string-join: <xsl:for-each-group select="$ap-groups" group-by="string-join(Appointment/@Date,':')"> Simon On Mon, Feb 13, 2012 at 14:02, Simon Pepping <sampepping@xxxxxxxxx> wrote: > Hi, > > This does the grouping that you want: > > <xsl:template match="/"> > <xsl:variable name="appointments" as="element(Appointment)+"> > <xsl:for-each select="//Invitee"> > <Appointment Date="{../@Date}" TimeOfDay="{../@TimeOfDay}" > AppointmentType="{../@AppointmentType}" > Firstname="{@Firstname}" Surname="{@Surname}" > Name="{concat(@Firstname,@Surname)}"/> > </xsl:for-each> > </xsl:variable> > <xsl:variable name="ap-groups" as="element(ap-group)+"> > <xsl:for-each-group select="$appointments" > group-by="concat(@TimeOfDay,'-',@AppointmentType,'-',@Name)"> > <ap-group key="{current-grouping-key()}"> > <xsl:for-each select="current-group()"> > <xsl:copy-of select="."/> > </xsl:for-each> > </ap-group> > </xsl:for-each-group> > </xsl:variable> > <xsl:variable name="ap-groups-by-set"> > <xsl:for-each-group select="$ap-groups" > group-by="xx:get-dates(Appointment/@Date,'')"> > <ap-group-by-set key="{current-grouping-key()}"> > <xsl:for-each select="current-group()"> > <xsl:copy-of select="."/> > </xsl:for-each> > </ap-group-by-set> > </xsl:for-each-group> > </xsl:variable> > <Appointments> > <xsl:for-each select="$ap-groups-by-set"> > <xsl:copy-of select="."/> > </xsl:for-each> > </Appointments> > </xsl:template> > > <xsl:function name="xx:get-dates"> > <xsl:param name="Dates"/> > <xsl:param name="dates"/> > <xsl:choose> > <xsl:when test="$Dates"> > <xsl:variable name="dates-c"> > <xsl:if test="$dates"> > <xsl:text>:</xsl:text> > </xsl:if> > </xsl:variable> > <xsl:value-of > select="xx:get-dates($Dates[position()!=1],concat($dates,$dates-c,$Dates[1])) "/> > </xsl:when> > <xsl:otherwise> > <xsl:value-of select="$dates"/> > </xsl:otherwise> > </xsl:choose> > </xsl:function>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|