[xsl] Re: Re: XPath expression to derive list of distinct element names

Subject: [xsl] Re: Re: XPath expression to derive list of distinct element names
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 10 Jan 2002 04:41:26 -0800 (PST)
> doesn't
>   select="$x//*[not(following::*[name()=name(current())])]"
> select all the element nodes in $x that are the last occurrence of an
>   element of that name?
> 
> David
> 
> 
> 
>    I don't think it can be done in XPath 1.0. The "implicit existential equals" in
> XPath works only on node-sets, so it's only useful for eliminating nodes that have
> duplicate string-values, not duplicate values of some other function such as name
> ().
> 
>    Mike Kay 

David,

The expression you're using cannot be evaluated in "pure XPath" -- that is, if XPath
is not instantiated by XSLT. The current() function is provided to XPath only when
its caller is XSLT.

If I'm not wrong, when XPath is instantiated, it must be passed certain parameters.
One of them is a list of variables' name-value pairs, the other is referred to as
"function library".

When for example XPath is initiated through the MSXML DOM (selectNodes(),
selectSingleNode(), etc), no variable definitions are passed to the XPath engine,
and it seems that the function library is empty.

The original question was if this was possible in an XPath expression but "not using
xsl".

It seems that Mike would be right, unless you come up with another XPath expression,
which does the job, but doesn't contain XSLT-specific functions.

Cheers,
Dimitre.





__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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


Current Thread