Subject: RE: dynamic grouping assignment
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 16 Jul 2007 11:52:01 +0100
|
I would do
group-by="string-join(receiver, operation, prev_bus_state, data,
for $x in $groupingKeys return saxon:evaluate($x/key), '|'))"
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: christoph.klocker@xxxxxx [mailto:christoph.klocker@xxxxxx]
> Sent: 16 July 2007 11:21
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: dynamic grouping assignment
>
> I have several such result blocks.
> <result>
> <receiver>Aktien</receiver>
> <operation>I</operation>
> <bus_state>OP</bus_state>
> <prev_bus_state></prev_bus_state>
> <pf_cod>600 </pf_cod>
> <xact_num>6281098</xact_num>
> <exec_num>46030</exec_num>
> <xact_dat>27-06-2007</xact_dat>
> <settle_dat>27-06-2007</settle_dat>
> <inst_qty>10</inst_qty>
> <inst_price>8.0</inst_price>
> <cur_cod>TRY</cur_cod>
> <settle_cur>TRY</settle_cur>
> <order_typ></order_typ>
> <order_typ_ref></order_typ_ref>
> <prev_xact_num></prev_xact_num>
> <ordr_block>block</ordr_block>
> </result>
>
> I always have to group after following elements receiver,
> operation, prev_bus_state, what I did by concating
> concat(receiver, operation, prev_bus_state, data)
>
> Now I need to assign dynamically additional grouping keys so
> that my group by statement would be
>
> concat(receiver, operation, prev_bus_state, data, ordr_block,
> order_typ)
>
> I tried now:concat(receiver, operation, data, prev_bus_state,
> string-join(for $x in $groupingKeys return $x/key, ','))
>
> where the parameter $groupingKeys is
>
> <xsl:param name=3D"groupingKeys" >
> <key>order_typ</key>
> <key>ordr_block</key>
> </xsl:param >
>
> the problem is, that the key elements are not evaluated. the
> grouping key contains the element names not the value of them:
> "AktienIordr_block,order_typ"
>
> I don't know how to use xx:evaluate() on more than one element.
>
> hope this makes it more clear.
> Christoph
>
>
> mike@xxxxxxxxxxxx@inet schrieb am 16.07.2007 10:27:29:
>
> > As with dynamic sorting: if you know that the dynamic keys will be
> simple
> > element names, you can use *[name()=$key]. For anything
> more complex,
> you
> > need xx:evaluate(). If you can't get this to work you'll
> need to show
> > us what you did before we can tell you what you did wrong.
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> > > -----Original Message-----
> > > From: christoph.klocker@xxxxxx [mailto:christoph.klocker@xxxxxx]
> > > Sent: 16 July 2007 06:49
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: dynamic grouping assignment
> > >
> > > Hi,
> > > How can I dynamically assing a grouping key, where I
> provide some of
> > > the grouping keys as parameters.
> > >
> > > I have the parameters
> > >
> > > <xsl:param name="groupingKeys" >
> > > <key>order_typ</key>
> > > <key>ordr_block</key>
> > > </xsl:param >
> > >
> > > I would like to add to the group-by evaluation.
> > >
> > > <xsl:for-each-group select="result"
> > > group-by="concat(receiver, operation, data, prev_bus_state,
> > > string-join(for $x in $groupingKeys return $x/key, ','))">
> > >
> > > I guess I need to use the saxon:evaluate() extension, but
> I couldn't
> > > get it right.
> > >
> > > thanks
> > >
> > >
> > > This message and any attachment ("the Message") are
> confidential. If
> > > you are not the intended recipient any use is strictly
> prohibited.
> > > If you have received the Message in error, please notify
> the sender
> > > immediately and delete the Message from your system, any use is
> > > forbidden.
> > > Correspondence via e-mail is primarily for information purposes.
> > > KAG/RVV/RIFA/ImmoKAG neither makes nor accepts legally binding
> > > statements unless otherwise agreed to the contrary.
> >
>
>
>
> This message and any attachment ("the Message") are
> confidential. If you are not the intended recipient any use
> is strictly prohibited. If you have received the Message in
> error, please notify the sender immediately and delete the
> Message from your system, any use is forbidden.
> Correspondence via e-mail is primarily for information
> purposes. KAG/RVV/RIFA/ImmoKAG neither makes nor accepts
> legally binding statements unless otherwise agreed to the contrary.
|