Damon,

There is no default namespace in this module - I double-checked using the 
commands you suggested, and the database name is the same as the one selected 
in CQ, and it logs "NS=" for the element I'm trying to select.

Since these two xpaths should evaluate to exactly the same thing:

//some-element
//node()[name(.)="some-element"]

I'm very surprised that one works and the other doesn't. I know there is some 
behind the scenes ML index magic that I don't understand, but if that were the 
issue, wouldn't it also break in CQ?

Best,

Will


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Damon Feldman
Sent: Tuesday, May 10, 2011 5:50 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Node selector xpath not working

Will,

Is there a default namespace at play? You can check by adding: 

xdmp:log(text{"NS=", namespace-uri(<cts:elem/>)})

to your module. Similarly, you can check the database by logging 

xdmp:database-name(xdmp:database()) 

to ensure the app server is looking at the data you think it is.

Yours,
Damon

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Will Thompson
Sent: Tuesday, May 10, 2011 3:05 PM
To: General MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Node selector xpath not working

doc("/config/config-file.xml")//some-element

CQ returns the expected elements, but the same query executed through the app 
server returns empty.  Same content source.  This is how I had to work around 
it in my app:

doc("/config/config-file.xml")//node()[name(.)="some-element"]

I don't see why one would work and not the other.  It's not a show stopper, but 
it's definitely bizarre.  Any ideas about what could be going on?

Thanks,

Will
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to