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

Is it possible to filter for all "distinct" nodes havi

Subject: Is it possible to filter for all "distinct" nodes having a"specific" date?
From: "Gregory Pearson" <GregP@xxxxxxxxx>
Date: Fri, 15 Mar 2002 11:53:54 -0900
filter distinct
Hi.  I am trying to get all the "distinct" records (by "pagename") for a specific date.  If I filter for just the "distinct" records it works.  If I filter for just the "specific" date it works.  If I do both at the same time it doesn't work.  Does anyone have any idea what I need to do differently?  Thanks

Please see the xml & xsl files below ...

[xsl file]

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

 <xsl:template match="/">
 
  <html>
  <body>
  
  <!-- GET ALL [RECORD] ELEMENTS WITH SPECIFIC DATE & DISTINCT 'pagename':  DOES NOT WORK IF BOTH ARE SPECIFIED -->
  <!-- <xsl:apply-templates select="records/record[translate(date,'/','')='31502' and not(preceding-sibling::record/pagename = pagename)]"/> -->
  
  <!-- GET ALL [RECORD] ELEMENTS WITH SPECIFIC DATE:  WORKS! -->
  <xsl:apply-templates select="records/record[translate(date,'/','')='31502']"/>
  
  <!-- GET ALL [RECORD] ELEMENTS WITH DISTINCT 'pagename':  WORKS! -->
  <!-- <xsl:apply-templates select="records/record[not(preceding-sibling::record/pagename = pagename)]"/> -->
    
  </body>
  </html>
 
 </xsl:template>
 
 <xsl:template match="record">
  
  PageName: <xsl:value-of select="pagename"/>
  Date:  <xsl:value-of select="date"/>
  <br></br>
   
 </xsl:template>
 
</xsl:stylesheet>




[xml file]



<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="test 1.xsl"?>

<records>
   
 <record>
    <pagename>A</pagename>
    <hits>100</hits>
    <date>21502</date>
 </record>
  
 <record>
    <pagename>A</pagename>
    <hits>200</hits>
    <date>21502</date>
 </record>
  
 <record>
    <pagename>B</pagename>
    <hits>100</hits>
    <date>21502</date>
 </record>
  
 <record>
    <pagename>B</pagename>
    <hits>200</hits>
    <date>21502</date>
 </record>
  
 <record>
    <pagename>C</pagename>
    <hits>100</hits>
    <date>21502</date>
 </record>
  
 <record>
    <pagename>C</pagename>
    <hits>100</hits>
    <date>21502</date>
 </record>
 
 <record>
    <pagename>A</pagename>
    <hits>100</hits>
    <date>31502</date>
 </record>
  
 <record>
    <pagename>A</pagename>
    <hits>200</hits>
    <date>31502</date>
 </record>
  
 <record>
    <pagename>B</pagename>
    <hits>100</hits>
    <date>31502</date>
 </record>
  
 <record>
    <pagename>B</pagename>
    <hits>200</hits>
    <date>31502</date>
 </record>
  
 <record>
    <pagename>C</pagename>
    <hits>100</hits>
    <date>31502</date>
 </record>
  
 <record>
    <pagename>C</pagename>
    <hits>200</hits>
    <date>31502</date>
 </record>
  
</records>






THANKS










 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.