xsl-list
[Top] [All Lists]

RE: SELECT DISTINCT QUERY

2003-05-24 00:43:38
Hi Onur,

You can use the Muenchian technique - the only slight addition will be
that you will probably need to place the additional filtering into the
<xsl:key>, i.e. your key will reference both the @name (for which you
want to find distinct values) and the @date (on which you want to
filter).

Something like...

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml"/>
<xsl:key name="kDistinctDateName" match="person"
use="concat(@date,'|',@name)"/>
<xsl:param name="today" select="'5/23/2003'"/>
<xsl:template match="salesStaff">
  <result>
    <xsl:copy-of select="person[generate-id() =
generate-id(key('kDistinctDateName',concat($today,'|',@name)))]"/>
  </result>
</xsl:template>
</xsl:stylesheet>

Hope this helps
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator




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



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