|
From: Dmitriy S. <sha...@gm...> - 2010-08-16 11:04:39
|
I did test it with saxon, the result is error message:
Error on line 3 of test:
XPDY0050: The root of the tree containing the context item is not a
document node
Query processing failed: Run-time errors were reported
So, it should be error, but different one.
On Sun, 2010-08-15 at 14:02 +0200, Jochen Graf wrote:
> Hi, I did some tests and found out that there is indeed a
> surprising behaviour with the "//"-selector within a predicate. e.g.
> this query returns the expected result:
>
> (1)
> let $link-pages := <root><element><no-data/></element></root>
> return
> element result { count($link-pages/*[//no-data] ) }
>
> ==> <result>1</result>
>
> As soon as you store the test document into the database, an error
> is thrown:
>
> (2)
> let $link-pages := doc('/db/test.xml')/*
> return
> element result { count($link-pages/*[//no-data] ) }
>
> ==> Internal evaluation error: context is missing for node 1.1.1 !
>
> This Query works again:
> (3)
> let $link-pages := <remove-context>{ doc('/db/test.xml')/*
> }</remove-context>
> return
> element result { count($link-pages/*[//no-data] ) }
>
> ==> <result>1</result>
>
> The "//"-selector does different things depending on if the
> document node has an "in-memory-document-context" or an
> "stored-document-context".
>
> Being careful and generally using the dot before the selector ".//"
> helps in
> any case.
--
Cheers,
Dmitriy Shabanov
|