can't call the outer most return value by name

Friday, 9 December 2011 · 2 messages
J
jidanni9 Dec 2011 22:56 #
Odd, one can see <R> but not access by it. Run this: declare function local:K($x){ switch ($x) case 2 return <R><name>N</name><o><name>Y</name></o></R> default return() }; " A",local:K(2)//*:R, " B",local:K(2)/o/name, (: shows we are already at the root :) " C",local:K(2)/., (: reveals R is really in there, but can't be called by name :) " D",local:K(2)/./R What's the deal?
CG
Christian Grün9 Dec 2011 23:01 #
Hi Jidanni,
<R/> needs to be accessed via the self axis, e.g.:

  <R><name>N</name><o><name>Y</name></o></R>/self::R
The following query..
  local:K(2)/R
..is a shortcut for
  local:K(2)/child::R
Hope this helps, Christian

⚡Generated with XQuery