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

compairing cousins?

Subject: compairing cousins?
From: "David Powell" <David.Powell@xxxxxxxxxxxxxxx>
Date: Mon, 18 Sep 2000 20:31:33 -0500
compairing
Comparing cousins, at least that is what I think you'd call it.  Apologies if this has been covered before.  I didn't search through all 14,960 items in the archive but I did spend a couple of hours looking.

I'm creating a table (on-line report).  I want to insert a row in the HTML table that'll contain just the date when the date changes.  My code (see below) is (I think) comparing all previous <mydate> elements with the current one.  This is VERY SLOW.  This database generated output is sorted by date so I really only need to compare the previous <mydate> with the current one. -and hopefully process the data a lot faster.  
If I understand correctly the siblings of <mydate> are <categoryid> and <eventid> so using preceding-sibling wouldn't help me.  

TIA,
David

Here's an XML Source fragment.
<?xml version="1.0" encoding="UTF-8" ?> 
<root> 
   <rowset count="1760"> 
      <row ID="0"> 
         <mydate>9/16/00</mydate> 
         <categoryid>1</categoryid> 
         <eventid>1</eventid> 
      </row> 
      <row ID="1"> 
         <mydate>9/16/00</mydate> 
         <categoryid>1</categoryid> 
         <eventid>1</eventid> 
      </row> 
      <row ID="2"> 
         <mydate>9/17/00</mydate> 
         <categoryid>1</categoryid> 
         <eventid>1</eventid> 
      </row> 
      <row ID="3"> 
         <mydate>9/17/00</mydate> 
         <categoryid>1</categoryid> 
         <eventid>1</eventid> 
      </row>    
   </rowset> 
</root> 
<!-- 
 This page was served in 213592 milliseconds by Cocoon 1.7.4 
--> 

Here's some XSL to transform the above to HTML

<?cocoon-process type="xsp"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:space="preserve" >
<!-- I cut a lot of stuff out here -->

<xsl:template match = "row">
   <xsl:f test="smdate[not(.=preceding::smdate)]">  <!--- *** THIS LINE IS SLOW *** -->
      <tr>
         <td colspan="3" align="center">
            <xsl:value-of select="smdate"/>
         </td>
      </tr>
   </xsl:if>

   <tr>
      <td><xsl:value-of select="categoryid"/></td>
      <td><xsl:value-of select="eventid"/></td>
   </tr>
</xsl:template>



 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.