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

RE: Grouping by a piece of a date

Subject: RE: Grouping by a piece of a date
From: Jeff Saylor <JSaylor@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Sep 2000 13:35:25 -0400
jeff saylor
Steve,

Thanks for the prompt reply - the idea is great (I didn't know I could use a
function in the 'using' param - actually I am [obviously] weak in the
xsl:key arena) except that:

   <xsl:key name="foo"
      match="/xml/rs:data/z:row"
      using="substring-before(@dCreated,'T')"/>

And using the Muenchian method for grouping:

   <xsl:for-each
 
select="/xml/z:row/@dCreated[generate-id(.)=generate-id(key('CreatedDates',.
))]" >
         <xsl:value-of select="." />
   </xsl:for-each>

produces no output.  Am I still missing something or is this just not
possible with the July MSXML release?

Again - appreciation in advance,

Jeffrey J. Saylor


PS weird to cite the name for something when it is named for the party I'm
typing to - should I have referred to it as "your" method? :) 


-----Original Message-----
From: Steve Muench [mailto:smuench@xxxxxxxxxxxxx]
Sent: Wednesday, September 06, 2000 10:42 AM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Re: Grouping by a piece of a date


| given xml with date attributes, I want to be able to group them by day.
| Using the Muenchian method I can group by the entire value, but I can't
| figure out how to group by only a piece of it.  For example, given the
| following XML:
| 
| <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
| xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
| xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
:
| <rs:data>
| <z:row iID="1" dCreated="1900-01-01T01:00:00"/>
| <z:row iID="2" dCreated="1900-01-02T01:00:00"/>
| <z:row iID="3" dCreated="1900-01-02T02:00:00"/>
| <z:row iID="4" dCreated="1900-01-04T01:00:00"/>
| </rs:data>
| </xml>

If I've not misunderstood what you're going for, then
you should be able to use the substring-before() function
in the <xsl:key> declaration like this:

<xsl:key name="foo"
         match="/xml/rs:data/z:row"
         using="substring-before(@dCreated,'T')"/>


This way, an attempt to lookup:

     key("foo","1900-01-02")

should find the <z:row> elements:

 <z:row iID="2" dCreated="1900-01-02T01:00:00"/>
 <z:row iID="3" dCreated="1900-01-02T02:00:00"/>

Because both of these have the substring-before their
"dCreated" attribute value of "1900-01-02".

______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly
http://www.oreilly.com/catalog/orxmlapp/





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


 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.