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

RE: FMPro, XSL eliminate dup display help needed

Subject: RE: FMPro, XSL eliminate dup display help needed
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 3 Aug 2004 20:42:08 +0100
fmpro template
 When the first letter of the title changes from 
> a -> b-> c, 

That's a pretty accurate description of the use case for which XSLT 2.0
group-adjacent is designed:

<xsl:for-each-group select="ROW/COL/DATA" group-adjacent="substring(.,1,1)">
  <a>...</a>
  <xsl:for-each select="current-group()">

In general, grouping in XSLT 1.0 is much harder. For this problem you have a
choice of (a) grouping entirely by value, ignoring the fact that the groups
are already adjacent, using the Muenchian grouping technique (see
http://www.jenitennison.com/xslt/grouping), or (b) writing a recursive
template to process the list of entries, starting a new level of recursion
whenever you hit a title that starts with a different letter from the
previous one.

However, it might be that a simpler solution will work here because you
don't actually need to wrap all the titles beginning with the same letter in
a parent element, you only need to output the <a> when the letter changes.
You can do this with something like

<xsl:template match="DATA">
   <xsl:if test="substring(.,1,1) != substring(preceding::DATA[1],1,1)">
     <a>...</a>
   </xsl:if>
   rest of logic
</xsl:template> 

With luck, someone will show you a worked solution.

Michael Kay

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.