Subject: RE: FW: grouping problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 17 Oct 2006 23:36:31 +0100
|
Write a function that decides which group a given value is in
<xsl:function name="my:group">
<xsl:param name="x"/>
<xsl:sequence select="$data/record[start le $x and end ge $x]/node/type"/>
</
then invoke this function in the group-by expression of xsl:for-each-group:
<xsl:for-each-group select="tokenize(range,',')" group-by="my:group(.)">
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: SINGH Navpreet [mailto:Navpreet.SINGH@xxxxxxxxx]
> Sent: 17 October 2006 22:44
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: FW: grouping problem
>
> Still waiting for reply on the following post. Can anyone
> help me with this.
> thanks.
>
> > -----Original Message-----
> > From: SINGH Navpreet
> > Sent: Tuesday, 17 October 2006 4:56 PM
> > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> > Subject: grouping problem
> >
> > Hi all,
> > Need help with the following problem which I suppose should use
> > xsl:group in XSLT2.0. What I want to do is to group the result by
> > <type> element (type1 and type2). Element <range> has all the valid
> > values and this should be used to find out all values that fall
> > between <start> and <end> element for each <record>. So expected
> > result is
> > type1: 0,2,4,5,6,7
> > type2: 0,7,8,9,A,B,C,D,E,F
> >
> > <data>
> > <range>0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F</range>
> > <record>
> > <start>0</start>
> > <end>0</end>
> > <node>
> > <type>type1</type>
> > </node>
> > </record>
> > <record>
> > <start>0</start>
> > <end>0</end>
> > <node>
> > <type>type2</type>
> > </node>
> > </record>
> > <record>
> > <start>2</start>
> > <end>2</end>
> > <node>
> > <type>type1</type>
> > </node>
> > </record>
> > <record>
> > <start>4</start>
> > <end>7</end>
> > <node>
> > <type>type1</type>
> > </node>
> > </record>
> > <record>
> > <start>7</start>
> > <end>F</end>
> > <node>
> > <type>type2</type>
> > </node>
> > </record>
> > </data>
> >
> > Thanks.
> >
>
> Disclaimer :
> The contents of this e-mail including any attachments are
> intended only for the person or entity to which this e-mail
> is addressed. If you are not, or believe you may not be, the
> intended recipient, please advise the sender immediately by
> return e-mail, delete this e-mail and destroy any copies.
> Tenix does not warrant nor guarantee that this email
> communication is free from errors, virus, interception or
> interference.
|