{"action":"created","issue":{"url":"https://api.github.com/repos/eXist-db/exist/issues/631","labels_url":"https://api.github.com/repos/eXist-db/exist/issues/631/labels{/name}","comments_url":"https://api.github.com/repos/eXist-db/exist/issues/631/comments","events_url":"https://api.github.com/repos/eXist-db/exist/issues/631/events","html_url":"https://github.com/eXist-db/exist/issues/631","id":79931947,"number":631,"title":"util:document-name() fails with simple map operator (!)","user":{"login":"joewiz","id":59118,"avatar_url":"https://avatars.githubusercontent.com/u/59118?v=3","gravatar_id":"","url":"https://api.github.com/users/joewiz","html_url":"https://github.com/joewiz","followers_url":"https://api.github.com/users/joewiz/followers","following_url":"https://api.github.com/users/joewiz/following{/other_user}","gists_url":"https://api.github.com/users/joewiz/gists{/gist_id}","starred_url":"https://api.github.com/users/joewiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joewiz/subscriptions","organizations_url":"https://api.github.com/users/joewiz/orgs","repos_url":"https://api.github.com/users/joewiz/repos","events_url":"https://api.github.com/users/joewiz/events{/privacy}","received_events_url":"https://api.github.com/users/joewiz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/eXist-db/exist/milestones/3","html_url":"https://github.com/eXist-db/exist/milestones/eXist-3.0","labels_url":"https://api.github.com/repos/eXist-db/exist/milestones/3/labels","id":710929,"number":3,"title":"eXist-3.0","description":"Long term development, with significant changes","creator":{"login":"dizzzz","id":1700062,"avatar_url":"https://avatars.githubusercontent.com/u/1700062?v=3","gravatar_id":"","url":"https://api.github.com/users/dizzzz","html_url":"https://github.com/dizzzz","followers_url":"https://api.github.com/users/dizzzz/followers","following_url":"https://api.github.com/users/dizzzz/following{/other_user}","gists_url":"https://api.github.com/users/dizzzz/gists{/gist_id}","starred_url":"https://api.github.com/users/dizzzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dizzzz/subscriptions","organizations_url":"https://api.github.com/users/dizzzz/orgs","repos_url":"https://api.github.com/users/dizzzz/repos","events_url":"https://api.github.com/users/dizzzz/events{/privacy}","received_events_url":"https://api.github.com/users/dizzzz/received_events","type":"User","site_admin":false},"open_issues":25,"closed_issues":32,"state":"open","created_at":"2014-07-05T12:32:58Z","updated_at":"2015-06-10T16:28:54Z","due_on":"2015-06-29T22:00:00Z","closed_at":null},"comments":1,"created_at":"2015-05-23T19:24:47Z","updated_at":"2015-06-12T10:51:30Z","closed_at":null,"body":"`util:document-name()` returns empty when in the context of a simple map operator (!).  For example, this query returns empty:\r\n\r\n```xquery\r\nxquery version \"3.0\";\r\n\r\ndeclare namespace h=\"http://www.w3.org/1999/xhtml\";\r\n\r\n//h:p ! util:document-name(.)\r\n```\r\n\r\nThe same operation, expressed as a FLWOR expression, works:\r\n\r\n```xquery\r\nxquery version \"3.0\";\r\n\r\ndeclare namespace h=\"http://www.w3.org/1999/xhtml\";\r\n\r\nfor $hit in //h:p\r\nreturn util:document-name($hit)\r\n```\r\n\r\nThis is using the current eXist develop branch."},"comment":{"url":"https://api.github.com/repos/eXist-db/exist/issues/comments/111446732","html_url":"https://github.com/eXist-db/exist/issues/631#issuecomment-111446732","issue_url":"https://api.github.com/repos/eXist-db/exist/issues/631","id":111446732,"user":{"login":"adamretter","id":1264057,"avatar_url":"https://avatars.githubusercontent.com/u/1264057?v=3","gravatar_id":"","url":"https://api.github.com/users/adamretter","html_url":"https://github.com/adamretter","followers_url":"https://api.github.com/users/adamretter/followers","following_url":"https://api.github.com/users/adamretter/following{/other_user}","gists_url":"https://api.github.com/users/adamretter/gists{/gist_id}","starred_url":"https://api.github.com/users/adamretter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamretter/subscriptions","organizations_url":"https://api.github.com/users/adamretter/orgs","repos_url":"https://api.github.com/users/adamretter/repos","events_url":"https://api.github.com/users/adamretter/events{/privacy}","received_events_url":"https://api.github.com/users/adamretter/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T10:51:30Z","updated_at":"2015-06-12T10:51:30Z","body":"I will also add that if you only have one node, then just a let/return is enough to make it work also:\r\n\r\n```xquery\r\nxquery version \"3.0\";\r\n\r\ndeclare namespace h=\"http://www.w3.org/1999/xhtml\";\r\n\r\nlet $p := //h:p[1]\r\nreturn\r\n  $p ! util:document-name(.)\r\n```"}}