Split node value with XPath
If you have an xpath-2.0 capable API, you can solve this in two ways:
replace technique
Try using:
fn:replace(string,pattern,replace)
e.g.
fn:replace(//path/text(),".*/","")
tokenize technique
You may get some mileage from tokenize:
fn:tokenize(string,pattern)
e.g. (thanks to Martin)
tokenize(/root/path, '\\')[last()]
w3schools xml processing "xsl functions" documentation
While I would use:
tokenize(/*/*, '\\')[last()]
there are also numerous other ways to obtain the desired string:
codepoints-to-string
(reverse
(string-to-codepoints
(substring-before
(codepoints-to-string
(reverse
(string-to-codepoints(/*/*)
)
),
'\'
)
)
)
)
Or:
substring(/*/*,
index-of(string-to-codepoints(/*/*),
string-to-codepoints('\')
)
[last()]
+ 1
)