The API documentation for xdmp:unpath()
http://developer.marklogic.com/pubs/4.1/apidocs/Extension.html#xdmp:unpath
claim that "any valid XPath expression (represented as a string) is a
valid input to xdmp:unpath". However, this is clearly not the case, as
it seems xdmp:unpath() is limited in the type of XPath predicate it can
accept.
Given a document /test.xml:
<doc>
<p n="1">par 1</p>
<p n="2">par 2</p>
</doc>
then xdmp:unpath('doc("/test.xml")//p') returns both <p> elements, and
xdmp:unpath('doc("/test.xml")//p[2]') returns the second one. But all of
these expressions return "Invalid format for unpath":
xdmp:unpath('doc("/test.xml")//p[last()]')
xdmp:unpath('doc("/test.xml")//p[position() eq 2]')
xdmp:unpath('doc("/test.xml")//p...@n]')
xdmp:unpath('doc("/test.xml")//p[true()]')
This is highly unintuitive. It seems that in fact the only syntax that
xdmp:unpath() will accept is the syntax produced by an xdmp:path()
expression, but the documentation doesn't say that.
David
--
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 801079, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: [email protected] Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general