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

RE: Is conditional group-by possible?

Subject: RE: Is conditional group-by possible?
From: "Jim Neff" <jneff@xxxxxxxxxxxxxxx>
Date: Tue, 25 Jan 2005 10:59:18 -0500
conditional group by
I realized that after I sent it out.

My intention was to simply the problem by using easier names in the group-by
clause but I forgot to fix the field names in my data when I copied it to my
e-mail.

--Jim

 

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx] 
Sent: Tuesday, January 25, 2005 11:02 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Is conditional group-by possible?

Yes, conditional grouping is possible, but the element names in your
stylesheet have to match those in your source document.

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

> -----Original Message-----
> From: Jim Neff [mailto:jneff@xxxxxxxxxxxxxxx]
> Sent: 25 January 2005 15:52
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Is conditional group-by possible?
> 
> Greetings,
> 
> Is a conditional group-by possible?
> 
> Here is what I tried:
> 
> <xsl:for-each-group 
>      select="Table" 
>      group-by="(if ((FED_ID_FLAG = 'F') 
>      and (not(FED_ID = ''))) 
>      then FED_ID 
>      else SOC_SEC_ID)">
> 
> And I get nothing in my output.
> 
> My input looks like simliar to this :
> 
> <NewDataSet>
>   <Table>    
>     <PROV_SOC_SEC_ID>111104550</PROV_SOC_SEC_ID>    
>     <PLOS_FED_ID_FLAG>S</PLOS_FED_ID_FLAG>
>     <PLOS_FED_ID>190404550</PLOS_FED_ID>
>     <PATIENT_LAST_NAME>Doe</PATIENT_LAST_NAME>
>     <PATIENT_FIRST_NAME>John</PATIENT_FIRST_NAME>    
>   </Table>
>   <Table>    
>     <PROV_SOC_SEC_ID>111104550</PROV_SOC_SEC_ID>
>     <PLOS_FED_ID_FLAG>S</PLOS_FED_ID_FLAG>
>     <PLOS_FED_ID>190404550</PLOS_FED_ID>
>     <PATIENT_LAST_NAME>Doe</PATIENT_LAST_NAME>
>     <PATIENT_FIRST_NAME>Jane</PATIENT_FIRST_NAME>    
>   </Table>
>   <Table>    
>     <PROV_SOC_SEC_ID>777104550</PROV_SOC_SEC_ID>
>     <PLOS_FED_ID_FLAG>F</PLOS_FED_ID_FLAG>
>     <PLOS_FED_ID>880121550</PLOS_FED_ID>
>     <PATIENT_LAST_NAME>Smith</PATIENT_LAST_NAME>
>     <PATIENT_FIRST_NAME>Mary</PATIENT_FIRST_NAME>    
>   </Table>
> </NewDataSet>
> 
> This should result in two groups, one 111104550, the other 880121550.
> 
> What I want is to use the FED_ID element to group by if the 
> FED_ID_FLAG = 'F' and FED_ID is an empty string.  Otherwise I want to 
> use the SOC_SEC_ID element to group.
> 
> Thanks in advance,
> Jim Neff

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.