string - Getting a substring of an attribute in XPATH -
given
<foo> <bar baz="hello, world!"> </foo> how last 4 characters of @baz? 1 of attempts was:
/foo/bar/@baz[substring( ., 0, -4 )]
use:
substring(/foo/bar/@baz, string-length(/foo/bar/@baz)-3) do note 3 in expression.
the following wrong:
substring(/foo/bar/@baz, string-length(/foo/bar/@baz)-4) because returns last 5 characters of string value of baz attribute.
Comments
Post a Comment