[xquery-talk] Help with an XQuery function

David Carlisle davidc at nag.co.uk
Tue May 15 09:12:40 PDT 2012


On 15/05/2012 17:02, Custer, Mark wrote:
> Thanks for pointing out the XQuery 3.0 functions, Matthias!
>
> fn:path is indeed supported, but I want a function that will do the same
> as fn:path, minus any of the values of “[1]”. Plus, since my current
> crop of documents don’t have any associated namespaces, the processor
> that I’m using prepends “Q{}” before each path. So, with the previous
> a/b/c example, I get the following:
>
> /Q{}a[1]/Q{}b[1]/Q{}c[3]
>
> But all I want is:
>
> /a/b/c[3]
>
> I’ll try working on it again later. Thanks again,
>
> Mark


sounds like

replace(path(),'\[1\]|Q{}','')

will do what you want.

David

-- 
google plus: https:/profiles.google.com/d.p.carlisle

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________


More information about the talk mailing list