xsl-list
[Top] [All Lists]

RE: for-each-group

2005-12-16 11:12:21
After sending this email I realized that my or in my group-by  field
actually worked.
<xsl:for-each-group select="xmlReportOutput/reportOutput/records/record"
            group-by="saxon:evaluate($sortColumn1)='Buy' or
saxon:evaluate($sortColumn1)='Sell'">

If I had more than two values is there a better way to emulate a SQL  IN
clause?

Regards,


Tom Maciejewski
Société Générale
Information Technology
1221 Avenue of the Americas
New York, NY 10020
Tel. (212) 278-7103
Cell. (917) 690-9541


                                                                                
                                                     
                      Thomas                                                    
                                                     
                      MACIEJEWSKI              To:      
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com                                
              
                                               cc:      
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com                                
              
                      12/16/2005 12:21         Subject: RE: [xsl] 
for-each-group(Document link: Thomas MACIEJEWSKI)                  
                      PM                                                        
                                                     
                                                                                
                                                     
                                                                                
                                                     



I am really sorry for this but I think my problem was grouping on he wrong
variable

Basically I needed to do:
<xsl:for-each-group select="current-group()" group-by="
saxon:evaluate($sortColumn3)='Internal'">
...
<xsl:variable name="group3" select="current-grouping-key()"/>
....

<xsl:choose>
      <xsl:when test="$counterParty">Internal</xsl:when>
      <xsl:otherwise>External</xsl:otherwise>
</xsl:choose>

And that works fine now ...   Sorry and thank you for the help.

Now a follow up to this issue.

If I need to test if a value is in a certain group of values what is the
best way to do that?

Like I need to test if a value is IN ( like a SQL IN ) a set of variables

if ( $variable IN "Buy,Sell")
      Buy/Sell
else
      Finance

I actually need to group by this so it would end up being something like
<xsl:for-each-group select="current-group()" group-by="
saxon:evaluate($sortColumn2)='Buy' or saxon:evaluate($sortColumn2)='Sell'">



Tom Maciejewski



                                                                                
                                                      
                      "Michael Kay"                                             
                                                      
                      <mike(_at_)saxonica(_dot_)co        To:       
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>                              
              
                      m>                       cc:                              
                                                      
                                               Subject:  RE: [xsl] 
for-each-group                                                     
                      12/16/2005 12:04                                          
                                                      
                      PM                                                        
                                                      
                      Please respond to                                         
                                                      
                      xsl-list                                                  
                                                      
                                                                                
                                                      
                                                                                
                                                      




I'd be grateful if you would show a (small) input document and the output
document you want to construct from it. I can't work out from the
information you've given so far what you are trying to do. I don't
understand where the Internal/not Internal split comes into it, and I can't
see what you're trying to do with each group of records having grouped
them.

You've got rid of saxon:evaluate() in one place but have retained it in
another - why? I suspect your variable group1 could use
current-grouping-key().

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: thomas(_dot_)maciejewski(_at_)sgcib(_dot_)com
[mailto:thomas(_dot_)maciejewski(_at_)sgcib(_dot_)com]
Sent: 16 December 2005 16:38
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] for-each-group

I got this working but not returning the correct results

here is my snippet:

                        <xsl:for-each-group select="
xmlReportOutput/reportOutput/records/record" group-by="
*[name()=$sortColumn1]">
                              <xsl:sort
select="current-grouping-key()"
order="descending"/>
                              <xsl:variable name="group1" select="
saxon:evaluate($sortColumn1)"/>
                              <xsl:call-template name="RenderByDesk">
                                    <xsl:with-param
name="tradeType" select
="$group1"/>
                              </xsl:call-template>
                        </xsl:for-each-group>

But now it is still grouping by CounterpartyRole.   I now
need to group
counterparty rule into either ='Internal' or != 'Internal'

I am not sure what I need to do here.   Basically I think I
need to change
my groupby to either be $sortColumn1 ( value ) = 'Internal' or not ...

How can I accomplish this ?

Regards,


Tom Maciejewski






                      "Michael Kay"


                      <mike(_at_)saxonica(_dot_)co        To:
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>

                      m>                       cc:


                                               Subject:  RE:
[xsl] for-each-group

                      12/12/2005 02:26


                      PM


                      Please respond to


                      xsl-list












And are you saying that the value "Internal" could appear in
any one of
these "columns": and you want one group for the records that have
"Internal"
as the value of the selected column, and another group for those that
don't?

Rather that using saxon:evaluate() here, it's much more
efficient to use
select="*[name()=$sortColumn]" - but this doesn't explain why it isn't
working.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: thomas(_dot_)maciejewski(_at_)sgcib(_dot_)com
[mailto:thomas(_dot_)maciejewski(_at_)sgcib(_dot_)com]
Sent: 12 December 2005 18:52
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] for-each-group

$sortColumn1 is the name of a column.

The record Data would look like this:

                  <record>
                        <value0><![CDATA[Buy]]></value0>
                        <value1><![CDATA[MMCOL]]></value1>
                        <value2><![CDATA[CCP]]></value2>
                        <value3><![CDATA[MS01]]></value3>
                        <value4><![CDATA[true]]></value4>
                        <value5>40475</value5>
                        <value6><![CDATA[PENDING]]></value6>
                        <value7>12724</value7>
                        <value8><![CDATA[SECURITY]]></value8>
                        <value9><![CDATA[GCF]]></value9>
                        <value10><![CDATA[RVP]]></value10>
                        <value11>100,000,000.00</value11>
                        <value12><![CDATA[TRIPARTY]]></value12>
                        <value13><![CDATA[09/29/2005]]></value13>
                        <value14><![CDATA[GSCC]]></value14>
                  </record>

$sortColumn1 would looke like "value2"


Regards,


Tom Maciejewski
Société Générale
Information Technology
1221 Avenue of the Americas
New York, NY 10020
Tel. (212) 278-7103
Cell. (917) 690-9541





                      "Michael Kay"


                      <mike(_at_)saxonica(_dot_)co        To:
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>

                      m>                       cc:


                                               Subject:  RE:
[xsl] for-each-group

                      12/12/2005 12:52


                      PM


                      Please respond to


                      xsl-list












What I want to do is to create a set of groups based on a
condition.  like
"foo='Internal'   is that allowed?

Yes, but showing your source and target documents would make
it clearer
what
you want to achieve.

what i have been trying is :

            <xsl:for-each-group select="
xmlReportOutput/reportOutput/records/record" group-by="
saxon:evaluate($sortColumn1)!='Internal'">

We need to understand here what $sortColumn1 contains.

I'm finding it difficult to give you any more help than this.
You haven't
given enough information to see what you are trying to
achieve, or to see
where your code is wrong. Take a couple of steps back and
start again.

Michael Kay
http://www.saxonica.com/




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



**************************************************************
***********
This message and any attachments (the "message") are
confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
E-mails are susceptible to alteration.
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates
shall be liable for the message if altered, changed or falsified.

**************************************************************
***********


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



**************************************************************
***********
This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
E-mails are susceptible to alteration.
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates
shall be liable for the message if altered, changed or falsified.

**************************************************************
***********

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





*************************************************************************
This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates 
shall be liable for the message if altered, changed or falsified. 

*************************************************************************

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>