Tricky XPath Question

Subject: Tricky XPath Question
From: disco <disco@xxxxxxxxxxxxxxx>
Date: Tue, 30 Nov 1999 23:09:15 -0500 (EST)
Hi,
 
I'm trying to select all <term> elements in a document (multiple of which
may have the same content), for which the element is the first containing
its content.

I can do this in XSLT using:

  <xsl:for-each select="//term">
    <!-- first select all the terms in the document -->
    <xsl:for-each select="*[count(preceding::term[. = current()]) = 0]">
      <!-- then select all of those for which the number of preceding
           terms with the same content is zero -->
      ...
    </>
  </>

but I'd like to be able to do this more succinctly using one XPath
expression. I would be able to do this simply using

  //term[count(preceding::term[. = current()]) = 0]

except current() in this case refers to something else, and not the term
element in question.

How could I solve this?

Thanks,
Dan


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread