[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: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Apr 2020 13:21:51 -0000
Re:  What does //distinct-values(...) mean?
Martin didn't say that it operated on a sequence of strings.

He explained that the "//" operator expands to address a bunch of nodes, and then the distinct-values() function is evaluated from each of those nodes.

XPath is evaluated from left to right and the "//" is evaluated before the distinct-values() function is evaluated.

I hope this helps.

. . . . . . Ken

At 2020-04-08 13:13 +0000, Costello, Roger L. costello@xxxxxxxxx wrote:

Hi Martin,



But, but, but, ...



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?



/Roger



-----Original Message-----

From: Martin Honnen martin.honnen@xxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>

Sent: Wednesday, April 8, 2020 8:25 AM

To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx

Subject: [EXT] Re: What does //distinct-values(...) mean?



Am 08.04.2020 um 14:19 schrieb Costello, Roger L. costello@xxxxxxxxx:

> Hi Folks,



> I executed this XPath query in Oxygen:



> //distinct-values(//Row[matches(Advertiser, 'TS3', 'i')]/Subscribers)



> The two slashes at the beginning were an accident. At the bottom of the screen Oxygen shows the matches. All of a sudden it showed 111,000 matches, then a moment later 438,000 matches, and then finally 525,946 matches.



> "Yikes!" I thought, "What is going on? There is supposed to be around 17 matches. How can there be half a million matches?"



> Then I saw the two slashes at the start.



> "Hmm, what is the meaning of two slashes preceding the distinct-values function?" I thought.



> So, I ask you: what is the meaning of two slashes preceding the distinct-values function? Why does its evaluation result in so many matches?



// is short for /descendant-or-self::node()/ so

//distinct-values(//Row[matches(Advertiser, 'TS3', 'i')]/Subscribers)

is

/descendant-or-self::node()/distinct-values(//Row[matches(Advertiser,

'TS3', 'i')]/Subscribers)

meaning it returns

distinct-values(//Row[matches(Advertiser, 'TS3', 'i')]/Subscribers)

as many times as the document has any nodes selectable by

/descendant-or-self::node().






--
Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/s/ |
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) |
Essays (UBL, XML, etc.) http://www.linkedin.com/today/author/gkholman |

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.