-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Element constructor creates document node. It should not. #1463
Comments
please could you fill in the issue-template? It makes sure you'll add all required information, info we need to understand the exact context. thnx |
@dizzzz I helped @mjhallman report these. Everything that is needed to reproduce is there. |
It's the |
A little investigation has shown that the problem is actually See the examples here: https://www.w3.org/TR/xpath-functions/#func-root-examples The following XQUnits show the issue: declare
%test:assertEquals("false")
function root:in-mem-element() {
fn:root(<anything/>) instance of document-node()
}; The above should return declare
%test:assertEquals("true")
function root:in-mem-document() {
fn:root(document { <anything/> }) instance of document-node()
}; The above should (and does in eXist-db) return |
@wolfgangmm I would welcome a discussion about this. From my perspective it requires quite some re-engineering of the in-memory DOM model, but before I do that... maybe you have some clever ideas to fix this up? |
@adamretter we know where the in-memory DOM is created by a constructor, so could just set a flag. |
Yes someone working on tei-publisher just stumbled on xquery version "3.0";
declare function local:node-kind
( $nodes as node()* ) as xs:string* {
for $node in $nodes
return
if ($node instance of element()) then 'element'
else if ($node instance of attribute()) then 'attribute'
else if ($node instance of text()) then 'text'
else if ($node instance of document-node()) then 'document-node'
else if ($node instance of comment()) then 'comment'
else if ($node instance of processing-instruction())
then 'processing-instruction'
else 'unknown'
} ;
let $data :=
<root xml:base="bl">
<dummy/>
</root>
return
local:node-kind(root($data)) exist 4.1.0 returns: I also think this is wrong, |
…de unless it was explicily created Closes eXist-db#1463
…de unless it was explicily created Closes eXist-db#1463
…de unless it was explicily created Closes eXist-db#1463
This returns
true
in eXist-db which is incorrect. The result of$x/root()
should be anelement()
.I have tested this on Saxon and BaseX which both correctly return
false
.The text was updated successfully, but these errors were encountered: