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

SELECT DISTINCT VALUES

Subject: SELECT DISTINCT VALUES
From: "test s" <stesting@xxxxxxxxxxx>
Date: Fri, 28 Mar 2003 09:46:40 +1100
xsl select distinct
HI EVERYONE,
I have a big problem that i can not solve it except with a select dinstinct records. and this is my last hope to solve this prolem, if any one have a suggestion, please send it to me.


Here is my problem and what i tried to do to solve it, but nothing worked.

1. I have this set of data:
<?xml version="1.0" encoding="UTF-8" ?><FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"><ERRORCODE>0</ERRORCODE><PRODUCT BUILD="08/16/2002" NAME="FileMaker Pro" VERSION="6.0v3"/><DATABASE DATEFORMAT="d/M/yyyy" LAYOUT="" NAME="NewLake_MainDatabase.fp5" RECORDS="210" TIMEFORMAT="h:mm:ss a"/><METADATA><FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="person_id" TYPE="NUMBER"/><FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="SeviceTotalHours_flag~c" TYPE="TEXT"/></METADATA><RESULTSET FOUND="6"><ROW MODID="12" RECORDID="33532"><COL><DATA>1</DATA></COL><COL><DATA>1_1_D</DATA></COL></ROW><ROW MODID="0" RECORDID="33544"><COL><DATA>13</DATA></COL><COL><DATA>2_0_D</DATA></COL></ROW><ROW MODID="0" RECORDID="33546"><COL><DATA>15</DATA></COL><COL><DATA>2_0_D</DATA></COL></ROW><ROW MODID="0" RECORDID="33547"><COL><DATA>16</DATA></COL><COL><DATA>2_0_D</DATA></COL></ROW><ROW MODID="0" RECORDID="33550"><COL><DATA>19</DATA></COL><COL><DATA>1_0_D</DATA></COL></ROW><ROW MODID="0" RECORDID="33552"><COL><DATA>21</DATA></COL><COL><DATA>1_0_D</DATA></COL></ROW></RESULTSET></FMPXMLRESULT>


2. I Created this stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp">
<xsl:template match="fmp:FMPXMLRESULT">
<People>
<xsl:for-each select="fmp:RESULTSET/fmp:ROW">
<personID>
<xsl:value-of select="fmp:COL[1]/fmp:DATA"/>
</personID>


<Categories>
<xsl:for-each select="//fmp:RESULTSET/fmp:ROW/fmp:COL[2]/fmp:DATA[not(.=preceding-sibling::fmp:RESULTSET/fmp:ROW/fmp:COL[125]/fmp:DATA)]">
<category>
<xsl:value-of select="."/>
</category>
</xsl:for-each>
</Categories>
</xsl:for-each>
</People>
</xsl:template>
</xsl:stylesheet>


3. This is the results it came up with:

 <?xml version="1.0" encoding="UTF-8" ?>
- <People>
 <personID>1</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>13</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>15</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>16</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>19</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>21</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 <category>1_0_D</category>
 </Categories>
 </People>




4. BUT THIS IS WHAT I WANT IT TO PRODUCE. a distinct list of the categories for every user.


 <?xml version="1.0" encoding="UTF-8" ?>
- <People>
 <personID>1</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>13</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>15</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>16</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>19</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 </Categories>
 <personID>21</personID>
- <Categories>
 <category>1_1_D</category>
 <category>2_0_D</category>
 <category>1_0_D</category>
 </Categories>
 </People>



This is a small example to make it easier for you, THANKS in advance ...




_________________________________________________________________
Hotmail now available on Australian mobile phones. Go to http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.