The second example doesn't provide a proper input. xdmp:unpath only handles
predicates dealing with position, for example  xdmp:unpath("$x/doc/item/
itemid[2]").  In order to do something like what you want to you would need
to use xdmp:value, but be careful as that could open holes for XQuery
injection if user input is being used for the string you are passing to
xdmp:value.

-Ryan Dew

On Fri, May 4, 2012 at 12:13 PM, Darin McBeath <[email protected]> wrote:

> If my  'unpath'  that contains a predicate, I get an error.
>
> For example,
>
> This will work,
>
> xdmp:unpath("$x/doc/item/itemid")
>
> but this will not:
>
> xdmp:unpath("$x/doc/item/itemid[@idtype='VAL']")
>
> I looked at the bug history (and fixed bugs) and didn't notice anything
> related to unpath.
>
> Curious if anyone else has noticed this, whether I'm doing something
> wrong, is there a workaround, etc.
>
> Thanks.
>
> Darin.
>
> _______________________________________________
> 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