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

RE: grouping (was: if or template?)

Subject: RE: grouping (was: if or template?)
From: Kevin Williams <Kevin.Williams@xxxxxxxxxxxxxx>
Date: Mon, 8 May 2000 12:01:27 -0400
xsl if or
I posted something very similar about a month ago to XML-L - it was my
last-ditch attempt to get around the (disturbing) lack of the preceding::
axis in MSXML3:

<xsl:for-each select="//favouritebook">
  <xsl:variable name="thisTitle" select="@title"/>
  <xsl:if test="generate-id(@title)=generate-id(//@title[.=$thisTitle])">
    ...
  </xsl:if> 
</xsl:for-each>

Using xsl:key is more elegant (and almost certainly faster) than using a
variable and xsl:if, as I did; however, since generate-id returns the
generated identifier for the first node in a node-set passed to it, the call
can be simplified somewhat:

<xsl:for-each
select="//tracker-id[generate-id(.)=generate-id(key('tid',.))]">

- Kevin

Kevin Williams
XML Architect
Ultraprise Corporation

> -----Original Message-----
> From: Kay Michael [mailto:Michael.Kay@xxxxxxx]

> This is the traditional solution; Steve Muench has just told 
> me about a
> brilliant alternative using keys:
> 
> <xsl:key name="tid" use="tracker-id" select="."/>
> 
> <xsl:for-each
> select="//tracker-id[generate-id(.)=generate-id(key('tid',.)[1])]">
> 


 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.