This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

compairing cousins?


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]