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

Re: What does //distinct-values(...) mean?

Subject: Re: What does //distinct-values(...) mean?
From: "Mukul Gandhi gandhi.mukul@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 9 Apr 2020 04:54:38 -0000
Re:  What does //distinct-values(...) mean?
On Wed, Apr 8, 2020 at 6:42 PM Costello, Roger L. costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:


> I thought that // operates on nodes. The distinct-values function doesn't
> return nodes, does it? I thought it returns a sequence of strings. If so,
> then how can // operate on a sequence of strings?
>

The relevant grammar productions from XPath 2.0 spec (ref
https://www.w3.org/TR/xpath20/#nt-bnf), that depict the semantics of '//'
operator are following,

"//" RelativePathExpr

RelativePathExpr   ::=   StepExpr (("/" | "//") StepExpr)*

StepExpr                ::=   FilterExpr | AxisStep

FilterExpr               ::=   PrimaryExpr PredicateList

AxisStep                ::=   (ReverseStep | ForwardStep) PredicateList

PrimaryExpr           ::=   Literal | VarRef | ParenthesizedExpr |
ContextItemExpr | FunctionCall

PredicateList           ::=   Predicate*

Predicate                ::=   "[" Expr "]"

The above XPath productions clearly shows that, the following XPath
expression
//distinct-values(..)

is allowed by the XPath language.

The signature of 'distinct-values(..)' function is specified as following
in the XPath 2.0 F&O spec,

fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType*

The above function signature, allows as argument to the function, a
sequence of atomic values or a sequence of nodes. In case the argument is
sequence of nodes, then it is converted to sequence of atomic values by the
process of atomization in order for the function to return meaningful
result.

Although, the expression //distinct-values(..) seems to be allowed by the
XPath spec, its run-time result looks to me ambiguous & should likely be
treated as implementation dependent, since the expression
//distinct-values(..) does not have any valid semantics.




-- 
Regards,
Mukul Gandhi

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.