> @Christian: On the other hand I can imagine that within Basex the path-expression is built from these elementary steps.
> If so, is it in any way possibly to retrieve this elementary steps sequence instead of this path-expression?
Hi Rob,
don't know whether your prefix is constant.
If it is then
let $prefix := "Q{http://www.w3.org/2005/xpath-functions}root()"
let $inpstr := "Q{http://www.w3.org/2005/xpath-functions}root()/Q{}A[1]/Q{}B[1]/Q{}C[1]/Q{}D[1]"
return ($prefix,
tokenize(substring-after($inpstr, $prefix),"/"))
should do the job.
M.
On 08/10/2014 13:37, Rob Stapper wrote:
Hi,
Basically I want to break down the path-expression of a node in my XML into its elementary steps.
QName: “Q{http://www.w3.org/2005/xpath-functions}root()/Q{}A[1]/Q{}B[1]/Q{}C[1]/Q{}D[1]” must become QName-sequence: (“Q{http://www.w3.org/2005/xpath-functions}root()”, ”Q{}A[1] ”, ”Q{}B[1] ”, ”Q{}C[1] ”, ”Q{}D[1]”)
So I need to break the path-expression down on the “/”-characters which aren’t part of the namespace-uries.
I’m using the “fn:tokenize”-function for this. The function uses a “regular expression” for it’s separator.
Unfortunately my regex-experience is zero (well, two days by now). I came up with the next brilliant ;-) solution: fn:tokenize( path( $node), “/(?=Q)”).
Again, unfortunately, this doesn’t work because the xquery-flavor of regex doesn’t support looking around.
Sure, I can use “/Q” as pattern and subsequently stick a “Q” in front of every substring (except the first one) but I’m looking for a solid solution.
I there anyone out there with enough “regex-for-xquery”- experience to help me with this?
Big thanx for that in advance.
@Christian: On the other hand I can imagine that within Basex the path-expression is built from these elementary steps.
If so, is it in any way possibly to retrieve this elementary steps sequence instead of this path-expression?
Thanx,
Rob Stapper
![]()
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus actief is.