Subject: Re: Simple XPath question
From: Phil Lanch <phil@xxxxxxxxxxxxxxx>
Date: Tue, 23 Nov 1999 10:19:16 +0000
|
Nikita Ogievetsky wrote:
>
> You are right. I did this in a rush and missed this case.
> The following constructs works with your fragment correctly:
>
> <xsl:for-each select="PERSON">
> <xsl:if test="following-sibling::PERSON[current()/@lastname =
> ./@lastname and current()/@firstname = ./@firstname]">
> <xsl:if test="not(preceding-sibling::PERSON[current()/@lastname =
> ./@lastname and current()/@firstname = ./@firstname])">
> <xsl:copy-of select="."/>
> </xsl:if>
> </xsl:if>
> </xsl:for-each>
Yes: neat.
I'd never really noticed the current() function before; it looks very
useful.
Again, current() is only in XSLT, not XPath,
so this doesn't meet Paul's request for an XPath solution.
But (drifting off-topic) why should XPath have a current() function
when XPointer, the other spec that uses XPath, doesn't need it
(since in XPointer it would always return the same value as /)?
--
cheers
phil
'"having more of a life is one of the earliest
and subtlest signs of mediocrity"' --- Musil
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|