Subject: Re: [xsl] XQuery/XPath 3.1: Node List to Node Set ("distinct nodes") From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 29 Dec 2021 19:58:58 -0000 |
On Wed, Dec 29, 2021 at 11:10 AM Martin Honnen martin.honnen@xxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > As I said, eXist-db is struggling > with generate-id based approaches, at least if nodes from different > document (fragments?) are involved. Yes, bugs happen... Just trying to evaluate Dr. Kay's fold-left solution with Saxon (EE9.1.7 via Oxygen) I am getting a result of 20 nodes but the correct must be just 3 nodes. BaseX correctly evaluates the XPath expression and produces the right 3-nodes result. Xml document: <t> <a/> <b/> <c/> </t> XSLT stylesheet: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"> <xsl:output omit-xml-declaration="yes"/> <xsl:template match="/"> <xsl:sequence select= "let $xml := /, $nodes := (/*/a, /*/c, /*/b, /*/a, /*/b, /*/a, /*/c, /*/b, /*/a, /*/b, /*/a, /*/c, /*/b, /*/a, /*/b, /*/a, /*/c, /*/b, /*/a, /*/b, /*/a, /*/c, /*/b, /*/a, /*/b, /*/a, /*/c, /*/b, /*/a, /*/b, /*/a, /*/c, /*/b, /*/a, /*/b, /*/a, /*/c, /*/b, /*/a, /*/b, /*/a, /*/c, /*/b, /*/a, /*/b ) return $nodes => fold-left((), function($all, $this) {$all, $this except $all})"/> </xsl:template> </xsl:stylesheet> Result produced when run with Saxon-EE (and also PE) 9.9.1.7 via Oxygen: <a/><c/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/><b/> Evaluating the below expression with Saxon-EE XQuery9.9.1.7 also produces the same unexpected result: let $xml := parse-xml("<t><a/><b/><c/></t>"), $nodes := ($xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b, $xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b, $xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b, $xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b, $xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b, $xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b,$xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b, $xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b, $xml/*/a, $xml/*/c, $xml/*/b, $xml/*/a, $xml/*/b ) return $nodes => fold-left((), function($all, $this) {$all, $this except $all}) Hopefully this is fixed in the next versions of Saxon? Cheers, Dimitre > > > > > > On Wed, Dec 29, 2021 at 10:27 AM Martin Honnen martin.honnen@xxxxxx > > <mailto:martin.honnen@xxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx > > <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> wrote: > > > > > I don't have to know one, I just pointed out that the spec doesn't > > > guarantee the order. Thus I don't see why, given the spec, one > should > > > expect any implementation to preserve the order. > > > > I am happy to state that the provided solution produces the correct > > result on all currently-existing XPath engines :) > > As if you had or could verify that. As I said, eXist-db is struggling > with generate-id based approaches, at least if nodes from different > document (fragments?) are involved. > > > -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- To avoid situations in which you might make mistakes may be the biggest mistake of all ------------------------------------ Quality means doing it right when no one is looking. ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play ------------------------------------- To achieve the impossible dream, try going to sleep. ------------------------------------- Facts do not cease to exist because they are ignored. ------------------------------------- Typing monkeys will write all Shakespeare's works in 200yrs.Will they write all patents, too? :) ------------------------------------- Sanity is madness put to good use. ------------------------------------- I finally figured out the only reason to be alive is to enjoy it.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XQuery/XPath 3.1: Node Li, Martin Honnen martin | Thread | Re: [xsl] XQuery/XPath 3.1: Node Li, Martin Honnen martin |
Re: [xsl] XQuery/XPath 3.1: Node Li, Liam R. E. Quin liam | Date | Re: [xsl] XQuery/XPath 3.1: Node Li, Dimitre Novatchev dn |
Month |