View Single Post
  #8 (permalink)  
Old March 2nd, 2010, 11:34 AM
Martin Honnen Martin Honnen is offline
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

The approach looks like this, assuming you always want to transform the complete document:
Code:
<xsl:template match="/">
  <xsl:variable name="sorted">
     <xsl:apply-templates mode="sort"/>
  </xsl:variable>
  <xsl:variable name="unique">
     <xsl:apply-templates select="$sorted/node()" mode="unique"/>
  </xsl:variable>
  <xsl:apply-templates select="$unique/node()"/>
</xsl:template>

<!-- now put all templates for sorting in mode="sort" e.g.
       <xsl:template match="index-item" mode="sort">
       
       </xsl:template>
       and all templates to eliminate duplicates in mode="unique"
       and then simply insert the templates from the last stylesheet
       that creates the ranges
-->
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Reply With Quote